summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2012-04-25 18:55:46 -0400
committerSimo Sorce <idra@samba.org>2012-04-26 16:14:24 +0200
commit1fbc18572543ed3056057df6ec4990278726fbf4 (patch)
tree59814a3f13d82c2cc1ab8b156564fc3df859d101
parent701fc995b75e392e896edc0c4314d758f7a5bee6 (diff)
downloadsamba-1fbc18572543ed3056057df6ec4990278726fbf4.tar.gz
samba-1fbc18572543ed3056057df6ec4990278726fbf4.tar.bz2
samba-1fbc18572543ed3056057df6ec4990278726fbf4.zip
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 <idra@samba.org> Autobuild-Date: Thu Apr 26 16:14:24 CEST 2012 on sn-devel-104
-rw-r--r--lib/replace/replace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index c076ba1fc8..322bf49e91 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);
}