diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-06-27 00:26:59 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-06-27 00:26:59 +0000 |
commit | 9e37076f2b8514a010008db44def4355e52379c2 (patch) | |
tree | 479f9848ff20c704e12b8a463cea629e51ab39e1 /source3 | |
parent | 94818add6c652c61d424dcb9e12f220dde05ddcf (diff) | |
download | samba-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')
-rw-r--r-- | source3/lib/util.c | 3 | ||||
-rw-r--r-- | source3/locking/shmem.c | 24 | ||||
-rw-r--r-- | source3/smbd/uid.c | 14 |
3 files changed, 25 insertions, 16 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 610f9f46a5..def84bf5ae 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2912,7 +2912,8 @@ connect_again: goto connect_again; } - if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY)) { + if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY || + errno == EAGAIN)) { DEBUG(1,("timeout connecting to %s:%d\n",inet_ntoa(*addr),port)); close(res); return -1; diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c index 9d4e62bdd7..f3f84ec8c3 100644 --- a/source3/locking/shmem.c +++ b/source3/locking/shmem.c @@ -87,7 +87,7 @@ static BOOL smb_shm_global_lock(void) if(smb_shm_times_locked > 1) { - DEBUG(2,("smb_shm_global_lock : locked %d times\n",smb_shm_times_locked)); + DEBUG(5,("smb_shm_global_lock : locked %d times\n",smb_shm_times_locked)); return True; } @@ -121,7 +121,7 @@ static BOOL smb_shm_global_unlock(void) if(smb_shm_times_locked > 0) { - DEBUG(2,("smb_shm_global_unlock : still locked %d times\n",smb_shm_times_locked)); + DEBUG(5,("smb_shm_global_unlock : still locked %d times\n",smb_shm_times_locked)); return True; } @@ -193,7 +193,7 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth else { /* erase old pid */ - DEBUG(2,("smb_shm_register_process : erasing stale record for pid %d (seek_back = %d)\n", + DEBUG(5,("smb_shm_register_process : erasing stale record for pid %d (seek_back = %d)\n", other_pid, seek_back)); other_pid = (pid_t)0; erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR); @@ -216,7 +216,7 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth if(free_slot < 0) free_slot = lseek(smb_shm_processes_fd, 0, SEEK_END); - DEBUG(2,("smb_shm_register_process : writing record for pid %d at offset %d\n",pid,free_slot)); + DEBUG(5,("smb_shm_register_process : writing record for pid %d at offset %d\n",pid,free_slot)); lseek(smb_shm_processes_fd, free_slot, SEEK_SET); if(write(smb_shm_processes_fd, &pid, sizeof(pid)) < 0) { @@ -252,11 +252,11 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid) while ((nb_read = read(smb_shm_processes_fd, &other_pid, sizeof(other_pid))) > 0) { - DEBUG(2,("smb_shm_unregister_process : read record for pid %d\n",other_pid)); + DEBUG(5,("smb_shm_unregister_process : read record for pid %d\n",other_pid)); if(other_pid == pid) { /* erase pid */ - DEBUG(2,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %d)\n", + DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %d)\n", other_pid, seek_back)); other_pid = (pid_t)0; erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR); @@ -330,7 +330,7 @@ static BOOL smb_shm_initialize(int size) { struct SmbShmBlockDesc * first_free_block_p; - DEBUG(2,("smb_shm_initialize : initializing shmem file of size %d\n",size)); + DEBUG(5,("smb_shm_initialize : initializing shmem file of size %d\n",size)); if( !smb_shm_header_p ) { @@ -388,7 +388,7 @@ BOOL smb_shm_open( char *file_name, int size) BOOL other_processes = True; int old_umask; - DEBUG(2,("smb_shm_open : using shmem file %s to be of size %d\n",file_name,size)); + DEBUG(5,("smb_shm_open : using shmem file %s to be of size %d\n",file_name,size)); old_umask = umask(0); #ifndef SECURE_SHARE_MODES @@ -508,7 +508,7 @@ BOOL smb_shm_close( void ) if(smb_shm_initialize_called == False) return True; - DEBUG(2,("smb_shm_close\n")); + DEBUG(5,("smb_shm_close\n")); if(smb_shm_times_locked > 0) DEBUG(0,("WARNING smb_shm_close : shmem was still locked %d times\n",smb_shm_times_locked));; if ((smb_shm_header_p != NULL) && @@ -518,7 +518,7 @@ BOOL smb_shm_close( void ) } smb_shm_global_lock(); - DEBUG(2,("calling smb_shm_unregister_process(%s, %d)\n", smb_shm_processreg_name, getpid())); + DEBUG(5,("calling smb_shm_unregister_process(%s, %d)\n", smb_shm_processreg_name, getpid())); smb_shm_unregister_process(smb_shm_processreg_name, getpid()); smb_shm_global_unlock(); @@ -629,7 +629,7 @@ smb_shm_offset_t smb_shm_alloc(int size) /* end modification of shared mem */ smb_shm_header_p->consistent = True; - DEBUG(2,("smb_shm_alloc : request for %d bytes, allocated %d bytes at offset %d\n",size,scanner_p->size*CellSize,result_offset )); + DEBUG(6,("smb_shm_alloc : request for %d bytes, allocated %d bytes at offset %d\n",size,scanner_p->size*CellSize,result_offset )); smb_shm_global_unlock(); return ( result_offset ); @@ -682,7 +682,7 @@ BOOL smb_shm_free(smb_shm_offset_t offset) smb_shm_header_p->consistent = False; - DEBUG(2,("smb_shm_free : freeing %d bytes at offset %d\n",header_p->size*CellSize,offset)); + DEBUG(6,("smb_shm_free : freeing %d bytes at offset %d\n",header_p->size*CellSize,offset)); if ( scanner_p == prev_p ) { 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; |