X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Ftemp%2Fmkdtemp.c;fp=src%2Ftemp%2Fmkdtemp.c;h=f2ecc5102ed996a92bf2da6bfdaf1bcf9899fc47;hp=162d98b0e38b1cfd760e80c7736f97fce1e0c03d;hb=446b4207cc7a30d8a4d5b2445a5a1b27d440f55d;hpb=3e9e30166f22f8fb0d5664500bb52a00d1a3c6a3 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; }