summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-01 17:32:45 +0000
committerJeremy Allison <jra@samba.org>2001-08-01 17:32:45 +0000
commit61bb3093e32e9e1e58cec079ea101b5b11c5fee0 (patch)
treea66bd0003c1458333d7523ca640369faa10e86c2 /source3/lib
parentc4a9fafc5640f158f142bba4facc8d1c0d2416fe (diff)
downloadsamba-61bb3093e32e9e1e58cec079ea101b5b11c5fee0.tar.gz
samba-61bb3093e32e9e1e58cec079ea101b5b11c5fee0.tar.bz2
samba-61bb3093e32e9e1e58cec079ea101b5b11c5fee0.zip
Pidfile check can be read-only. Removed old ifdef in password.c
Jeremy. (This used to be commit d82efc61ef16533c5652a5d4a9863f8317cb4ea2)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/pidfile.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index 25ff85483d..9de672010a 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -41,7 +41,7 @@ pid_t pidfile_pid(char *name)
slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name);
- fd = sys_open(pidFile, O_NONBLOCK | O_RDWR, 0644);
+ fd = sys_open(pidFile, O_NONBLOCK | O_RONLY, 0644);
if (fd == -1) {
return 0;
}
@@ -49,24 +49,24 @@ pid_t pidfile_pid(char *name)
ZERO_ARRAY(pidstr);
if (read(fd, pidstr, sizeof(pidstr)-1) <= 0) {
- goto ok;
+ goto noproc;
}
ret = atoi(pidstr);
if (!process_exists((pid_t)ret)) {
- goto ok;
+ goto noproc;
}
- if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)) {
+ if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_RDLCK)) {
/* we could get the lock - it can't be a Samba process */
- goto ok;
+ goto noproc;
}
close(fd);
return (pid_t)ret;
- ok:
+ noproc:
close(fd);
unlink(pidFile);
return 0;