diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-11 23:19:08 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-11 23:19:08 +0000 |
commit | 9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2 (patch) | |
tree | bdc6eaae03c19472a14480c1c5b9d36c6b3ef1fe /source/lib | |
parent | 20b13bafdff2fd7be9219ed164e7fe91b597298d (diff) | |
download | samba-9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2.tar.gz samba-9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2.tar.xz samba-9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2.zip |
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.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/smbrun.c | 2 | ||||
-rw-r--r-- | source/lib/sysacls.c | 1 | ||||
-rw-r--r-- | source/lib/util.c | 14 |
3 files changed, 15 insertions, 2 deletions
diff --git a/source/lib/smbrun.c b/source/lib/smbrun.c index 2b7d1418347..e039f222fca 100644 --- a/source/lib/smbrun.c +++ b/source/lib/smbrun.c @@ -34,7 +34,7 @@ static BOOL setup_stdout_file(char *outfile,BOOL shared) { int fd; mode_t mode = S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH; - int flags = O_RDWR|O_CREAT|O_TRUNC|O_EXCL; + int flags = O_RDWR|O_CREAT|O_EXCL; close(1); diff --git a/source/lib/sysacls.c b/source/lib/sysacls.c index 778f467c12b..59f8e2e043f 100644 --- a/source/lib/sysacls.c +++ b/source/lib/sysacls.c @@ -1221,7 +1221,6 @@ int sys_acl_free_acl(SMB_ACL_T the_acl) return acl_free(the_acl); } ->>>>>>> 1.15 #else /* No ACLs. */ int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p) diff --git a/source/lib/util.c b/source/lib/util.c index cd1395aba73..42a9617077d 100644 --- a/source/lib/util.c +++ b/source/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 |