diff options
Diffstat (limited to 'src/temp/mkdtemp.c')
-rw-r--r-- | src/temp/mkdtemp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/temp/mkdtemp.c b/src/temp/mkdtemp.c index 162d98b0..f2ecc510 100644 --- a/src/temp/mkdtemp.c +++ b/src/temp/mkdtemp.c @@ -12,7 +12,8 @@ char *__mktemp(char *); char *mkdtemp(char *template) { - for (;;) { + int retries = 100; + while (retries--) { if (!__mktemp(template)) return 0; if (!mkdir(template, 0700)) return template; if (errno != EEXIST) return 0; @@ -20,4 +21,5 @@ char *mkdtemp(char *template) * that we have a valid template string */ strcpy(template+strlen(template)-6, "XXXXXX"); } + return 0; } |