#include "c.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Go to the source code of this file.
|
static int | GETTEMP (char *path, int *doopen, int domkdir) |
|
char * | mkdtemp (char *path) |
|
◆ _DIAGASSERT
#define _DIAGASSERT |
( |
|
x | ) |
do {} while (0) |
◆ GETTEMP()
static int GETTEMP |
( |
char * |
path, |
|
|
int * |
doopen, |
|
|
int |
domkdir |
|
) |
| |
|
static |
Definition at line 94 of file mkdtemp.c.
106 static char xtra[2] =
"aa";
115 for (trv = path; *trv; ++trv)
134 for (; xcnt > 0; xcnt--)
136 *--trv = (pid % 10) +
'0';
156 for (start = trv + 1;; --trv)
165 e =
stat(path, &sbuf);
168 return doopen == NULL && !domkdir;
172 return doopen == NULL && !domkdir;
183 open(path, O_CREAT | O_EXCL | O_RDWR, 0600)) >= 0)
190 if (
mkdir(path, 0700) >= 0)
195 else if (
lstat(path, &sbuf))
196 return errno == ENOENT ? 1 : 0;
207 if (isdigit((
unsigned char) *trv))
References _DIAGASSERT, lstat, mkdir, S_ISDIR, stat::st_mode, and stat.
Referenced by mkdtemp().
◆ mkdtemp()
char* mkdtemp |
( |
char * |
path | ) |
|