Explorar o código

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

Mike Frysinger %!s(int64=17) %!d(string=hai) anos
pai
achega
4a38f88b2c
Modificáronse 1 ficheiros con 3 adicións e 4 borrados
  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