diff options
author | Jeremy Allison <jra@samba.org> | 2006-11-02 09:37:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:41 -0500 |
commit | 27c4b072b06881fca8bab8a5f07a9e7ce5de173f (patch) | |
tree | 45305520888eff09fed5948c690f6aaa3d0244d7 | |
parent | b7bf248985c9503ff9f78dc3d7602066943fe030 (diff) | |
download | samba-27c4b072b06881fca8bab8a5f07a9e7ce5de173f.tar.gz samba-27c4b072b06881fca8bab8a5f07a9e7ce5de173f.tar.bz2 samba-27c4b072b06881fca8bab8a5f07a9e7ce5de173f.zip |
r19533: Add a suffix to the program name if this is a process with a
non-default configuration file name.
Jeremy.
(This used to be commit e8bf421c018ed829b9dba7c0872693080b77d49d)
-rw-r--r-- | source3/Makefile.in | 4 | ||||
-rw-r--r-- | source3/lib/pidfile.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index f21548562b..ad2c507da9 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -965,6 +965,10 @@ dynconfig.o: dynconfig.c Makefile echo "$(CC) $(FLAGS) $(PATH_FLAGS) $(PICFLAG) -c $(srcdir)/dynconfig.c -o $@" 1>&2;\ $(CC) $(FLAGS) $(PATH_FLAGS) $(PICFLAG) -c $(srcdir)/dynconfig.c -o $@ >/dev/null 2>&1 +lib/pidfile.o: lib/pidfile.c + @echo Compiling $*.c + @$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) $(PICFLAG) -c $(srcdir)/lib/pidfile.c -o $@ + lib/version.o: lib/version.c include/version.h @echo Compiling $*.c @$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) $(PICFLAG) -c $(srcdir)/lib/version.c -o $@ diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 08e41083b5..49626acade 100644 --- a/source3/lib/pidfile.c +++ b/source3/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); |