summaryrefslogtreecommitdiff
path: root/source3/smbd/uid.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-06-27 00:26:59 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-06-27 00:26:59 +0000
commit9e37076f2b8514a010008db44def4355e52379c2 (patch)
tree479f9848ff20c704e12b8a463cea629e51ab39e1 /source3/smbd/uid.c
parent94818add6c652c61d424dcb9e12f220dde05ddcf (diff)
downloadsamba-9e37076f2b8514a010008db44def4355e52379c2.tar.gz
samba-9e37076f2b8514a010008db44def4355e52379c2.tar.bz2
samba-9e37076f2b8514a010008db44def4355e52379c2.zip
shmem.c: Changed debug to higher level
uid.c: Stop smbrun from deleting device files. util.c: Added EAGAIN to known error list. Jeremy (jallison@whistle.com) (This used to be commit c07db8d8e7e4a421501a08efe999e9ccd7337855)
Diffstat (limited to 'source3/smbd/uid.c')
-rw-r--r--source3/smbd/uid.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 7a903e0551..0cf1c217a9 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -339,7 +339,9 @@ the child as it may leave the caller in a privilaged state.
static BOOL setup_stdout_file(char *outfile,BOOL shared)
{
int fd;
+ struct stat st;
mode_t mode = S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH;
+ int flags = O_RDWR|O_CREAT|O_TRUNC|O_EXCL;
close(1);
@@ -354,9 +356,15 @@ static BOOL setup_stdout_file(char *outfile,BOOL shared)
#endif
}
- /* now create the file with O_EXCL set */
- unlink(outfile);
- fd = open(outfile,O_RDWR|O_CREAT|O_TRUNC|O_EXCL,mode);
+ if(stat(outfile, &st) == 0) {
+ /* Check we're not deleting a device file. */
+ if(st.st_mode & S_IFREG)
+ unlink(outfile);
+ else
+ flags = O_RDWR;
+ }
+ /* now create the file */
+ fd = open(outfile,flags,mode);
if (fd == -1) return False;