summaryrefslogtreecommitdiffstats
path: root/source/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
commitc07db8d8e7e4a421501a08efe999e9ccd7337855 (patch)
treea623a5d6810e1969f4bd837c790daddca9c1d303 /source/smbd/uid.c
parent74d29668eed397590d0a5c7460cb715d9331b4f6 (diff)
downloadsamba-c07db8d8e7e4a421501a08efe999e9ccd7337855.tar.gz
samba-c07db8d8e7e4a421501a08efe999e9ccd7337855.tar.xz
samba-c07db8d8e7e4a421501a08efe999e9ccd7337855.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)
Diffstat (limited to 'source/smbd/uid.c')
-rw-r--r--source/smbd/uid.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/smbd/uid.c b/source/smbd/uid.c
index 7a903e05511..0cf1c217a9b 100644
--- a/source/smbd/uid.c
+++ b/source/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;