From 9e37076f2b8514a010008db44def4355e52379c2 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Fri, 27 Jun 1997 00:26:59 +0000 Subject: 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) --- source3/smbd/uid.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source3/smbd/uid.c') 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; -- cgit