From 6578fd874283ee97c2896bcf7257db7f3e37c2ec Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Apr 2001 23:19:08 +0000 Subject: To stop people complaining about the mktemp call, move it into lib/util.c. Thanks to Andrew for all this code. Fixed extra line in lib/sysacls.c that broke XFS ACL code. Jeremy. (This used to be commit 9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2) --- source3/lib/util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index cd1395aba7..42a9617077 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1742,6 +1742,20 @@ char *smbd_mktemp(char *template) return p; } +/***************************************************************** +possibly replace mkstemp if it is broken +*****************************************************************/ +int smb_mkstemp(char *template) +{ +#if HAVE_SECURE_MKSTEMP + return mkstemp(template); +#else + /* have a reasonable go at emulating it. Hope that + the system mktemp() isn't completly hopeless */ + if (!mktemp(template)) return -1; + return open(template, O_CREAT|O_EXCL|O_RDWR, 0600); +#endif +} /***************************************************************** like strdup but for memory -- cgit