1/* 2 * Copyright (c) 1987, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35#if 0 36static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/lib/libc/stdio/mktemp.c 56698 2000-01-27 23:07:25Z jasone $"; |
40#endif /* LIBC_SCCS and not lint */ 41 42#include <sys/types.h> 43#include <sys/stat.h> 44#include <fcntl.h> 45#include <errno.h> 46#include <stdio.h> 47#include <stdlib.h> --- 110 unchanged lines hidden (view full) --- 158 break; 159 } 160 } 161 } 162 163 for (;;) { 164 if (doopen) { 165 if ((*doopen = |
166 _open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0) |
167 return(1); 168 if (errno != EEXIST) 169 return(0); 170 } else if (domkdir) { 171 if (mkdir(path, 0700) == 0) 172 return(1); 173 if (errno != EEXIST) 174 return(0); --- 22 unchanged lines hidden --- |