From: Simo Sorce Date: Wed, 25 Apr 2012 22:55:46 +0000 (-0400) Subject: replace: Fix use of mktemp X-Git-Tag: samba-4.0.0alpha20~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fbc18572543ed3056057df6ec4990278726fbf4;p=thirdparty%2Fsamba.git replace: Fix use of mktemp mktemp always returns the template, so checking for NULL doesn't cactch any error. Errors are reported by turning the template into an empty string. Autobuild-User: Simo Sorce Autobuild-Date: Thu Apr 26 16:14:24 CEST 2012 on sn-devel-104 --- diff --git a/lib/replace/replace.c b/lib/replace/replace.c index c076ba1fc8b..322bf49e91b 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -412,8 +412,8 @@ int rep_mkstemp(char *template) { /* have a reasonable go at emulating it. Hope that the system mktemp() isn't completely hopeless */ - char *p = mktemp(template); - if (!p) + mktemp(template); + if (template[0] == 0) return -1; return open(p, O_CREAT|O_EXCL|O_RDWR, 0600); }