From 4a38f88b2caeac2faee85fb80606cc9732faa1f7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 24 Jan 2007 10:09:41 +0000 Subject: fix from Bryan Wu: return NULL upon error, not the NULL string --- libc/stdlib/mkdtemp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libc/stdlib/mkdtemp.c') diff --git a/libc/stdlib/mkdtemp.c b/libc/stdlib/mkdtemp.c index 20a2e16bc..fa9ae3b05 100644 --- a/libc/stdlib/mkdtemp.c +++ b/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 -- cgit v1.2.3