diff options
author | Gerald Carter <jerry@samba.org> | 2006-11-06 20:10:30 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2006-11-06 20:10:30 +0000 |
commit | 76cc7dedb3a5434232a29d3d6e33bf84184e2d76 (patch) | |
tree | 6e03d843dc100d65201b1833fff36cafbfcb1cad /source/lib/pidfile.c | |
parent | 47dde11977c259e804ae67f1507d0e2f7e8263fc (diff) | |
download | samba-76cc7dedb3a5434232a29d3d6e33bf84184e2d76.tar.gz samba-76cc7dedb3a5434232a29d3d6e33bf84184e2d76.tar.xz samba-76cc7dedb3a5434232a29d3d6e33bf84184e2d76.zip |
r19581: Merge from SAMBA_3_0_23
Diffstat (limited to 'source/lib/pidfile.c')
-rw-r--r-- | source/lib/pidfile.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/lib/pidfile.c b/source/lib/pidfile.c index 08e41083b59..49626acade5 100644 --- a/source/lib/pidfile.c +++ b/source/lib/pidfile.c @@ -78,13 +78,24 @@ pid_t pidfile_pid(const char *name) } /* create a pid file in the pid directory. open it and leave it locked */ -void pidfile_create(const char *name) +void pidfile_create(const char *program_name) { int fd; char buf[20]; + char *short_configfile; + pstring name; pstring pidFile; pid_t pid; + /* Add a suffix to the program name if this is a process with a + * none default configuration file name. */ + if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) { + strncpy( name, program_name, sizeof( name)-1); + } else { + short_configfile = strrchr( dyn_CONFIGFILE, '/'); + slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile+1); + } + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); pid = pidfile_pid(name); |