[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Thu May 31 13:22:37 MDT 2012


The branch, v3-6-test has been updated
       via  1a59607 s3-pid: Catch with pid filename's change when config file is not smb.conf
      from  ddad733 Fix bug #8627: Crash bug in dns_create_probe.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 1a596076697624545f415eb558c4647267cfe46c
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Jan 24 21:29:11 2012 -0800

    s3-pid: Catch with pid filename's change when config file is not smb.conf
    
    This is what is done in pidfile_create
    (cherry picked from commit 9b43ad4fcac1eb6796973336c5614b18a054080d)
    
    Fix bug #8714 (smbcontrol can't find the pid file of winbindd because the later
    is created with a different name).

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/pidfile.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index 88d0fb0..06fca91 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -30,18 +30,42 @@ static char *pidFile_name = NULL;
 
 /* return the pid in a pidfile. return 0 if the process (or pidfile)
    does not exist */
-pid_t pidfile_pid(const char *name)
+pid_t pidfile_pid(const char *program_name)
 {
 	int fd;
 	char pidstr[20];
 	pid_t pid;
 	unsigned int ret;
+	char *name;
+	const char *short_configfile;
 	char * pidFile;
 
+	/* Add a suffix to the program name if this is a process with a
+	 * none default configuration file name. */
+	if (strcmp( CONFIGFILE, get_dyn_CONFIGFILE()) == 0) {
+		name = SMB_STRDUP(program_name);
+	} else {
+		short_configfile = strrchr( get_dyn_CONFIGFILE(), '/');
+		if (short_configfile == NULL) {
+			/* conf file in current directory */
+			short_configfile = get_dyn_CONFIGFILE();
+		} else {
+			/* full/relative path provided */
+			short_configfile++;
+		}
+		if (asprintf(&name, "%s-%s", program_name,
+				short_configfile) == -1) {
+			smb_panic("asprintf failed");
+		}
+	}
+
 	if (asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name) == -1) {
+		SAFE_FREE(name);
 		return 0;
 	}
 
+	SAFE_FREE(name);
+
 	fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
 	if (fd == -1) {
 		SAFE_FREE(pidFile);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list