Browse Source

fix from Bryan Wu: return NULL upon error, not the NULL string

Mike Frysinger 17 years ago
parent
commit
4a38f88b2c
1 changed files with 3 additions and 4 deletions
  1. 3 4
      libc/stdlib/mkdtemp.c

+ 3 - 4
libc/stdlib/mkdtemp.c

@@ -29,10 +29,9 @@
    (This function comes from OpenBSD.) */
 char * mkdtemp (char *template)
 {
-    if (__gen_tempname (template, __GT_DIR))
-	/* We return the null string if we can't find a unique file name.  */
-	template[0] = '\0';
-
+  if (__gen_tempname (template, __GT_DIR))
+    return NULL;
+  else
     return template;
 }
 #endif