[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Tue Sep 4 14:18:02 MDT 2012


The branch, master has been updated
       via  2172a14 s3: in sys_popen(), add a debug message for failed fork
       via  c1b703f s3: in sys_popen(), add a debug message for failed extract_args()
       via  6c7df39 s3: in sys_popen(), untangle function call from result check
       via  1d4fe78 s3: in sys_popen(), untangle assigment from check and add a debug message in failure case
       via  d43c411 s3: in sys_popen(), improve call to pipe and report error to debug
       via  243157a s3: in sys_popen(), validate input before opening the pipe.
       via  e7d385c s3: in sys_popen(), fix a debug message
       via  b1966f3 s3:smbd: in sys_disk_free(), improve a debug message
       via  cc99189 s3:smbd: in sys_disk_free(), improve a debug message
       via  04ac781 s3:smbd: in sys_disk_free(), fix line length and indentation of debug statement
       via  a56d2de s3:smbd: in sys_disk_free(), fix a debug message
      from  3390d99 s3-winbind: DON'T PANIC if we couldn't find the domain.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2172a1448e8798b4df50d5874b38a252d15b3ad0
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:25:42 2012 +0200

    s3: in sys_popen(), add a debug message for failed fork
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Tue Sep  4 22:17:30 CEST 2012 on sn-devel-104

commit c1b703f95cb35798c4948aa01b9cb75184c29522
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:24:46 2012 +0200

    s3: in sys_popen(), add a debug message for failed extract_args()

commit 6c7df39feeaeebeca88562e575aa0c803559b0d7
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:23:01 2012 +0200

    s3: in sys_popen(), untangle function call from result check

commit 1d4fe78db928c5f68aa805d1f5dc6a941fbb10fc
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:19:46 2012 +0200

    s3: in sys_popen(), untangle assigment from check and add a debug message in failure case

commit d43c411fb19707f1b57177e9a3300573018cc849
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:17:37 2012 +0200

    s3: in sys_popen(), improve call to pipe and report error to debug

commit 243157ae345f32b06f9c1a223139891339d0ad82
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:15:42 2012 +0200

    s3: in sys_popen(), validate input before opening the pipe.

commit e7d385c366f04586c6e1490ea0a8cd4b1225f552
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 14:21:37 2012 +0200

    s3: in sys_popen(), fix a debug message

commit b1966f31188abcadabb48090cccfccaae150445e
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:02:40 2012 +0200

    s3:smbd: in sys_disk_free(), improve a debug message

commit cc99189de1330074d10012578a1729d7be1e41f5
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 15:01:18 2012 +0200

    s3:smbd: in sys_disk_free(), improve a debug message

commit 04ac7816262dcb69dd88fe0409c5bd03ab894f56
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 14:50:53 2012 +0200

    s3:smbd: in sys_disk_free(), fix line length and indentation of debug statement

commit a56d2dea06aa089330c8d7df32c124abf1fab851
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 4 14:50:15 2012 +0200

    s3:smbd: in sys_disk_free(), fix a debug message

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

Summary of changes:
 source3/lib/system.c |   27 +++++++++++++++++++--------
 source3/smbd/dfree.c |    7 ++++---
 2 files changed, 23 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/system.c b/source3/lib/system.c
index 2881fd6..d69f1c6 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -1161,32 +1161,43 @@ int sys_popen(const char *command)
 	char **argl = NULL;
 	int ret;
 
-	if (pipe(pipe_fds) < 0)
+	if (!*command) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	ret = pipe(pipe_fds);
+	if (ret < 0) {
+		DEBUG(0, ("sys_popen: error opening pipe: %s\n",
+			  strerror(errno)));
 		return -1;
+	}
 
 	parent_end = pipe_fds[0];
 	child_end = pipe_fds[1];
 
-	if (!*command) {
-		errno = EINVAL;
+	entry = SMB_MALLOC_P(popen_list);
+	if (entry == NULL) {
+		DEBUG(0, ("sys_popen: malloc failed\n"));
 		goto err_exit;
 	}
 
-	if((entry = SMB_MALLOC_P(popen_list)) == NULL)
-		goto err_exit;
-
 	ZERO_STRUCTP(entry);
 
 	/*
 	 * Extract the command and args into a NULL terminated array.
 	 */
 
-	if(!(argl = extract_args(NULL, command)))
+	argl = extract_args(NULL, command);
+	if (argl == NULL) {
+		DEBUG(0, ("sys_popen: extract_args() failed: %s\n", strerror(errno)));
 		goto err_exit;
+	}
 
 	entry->child_pid = fork();
 
 	if (entry->child_pid == -1) {
+		DEBUG(0, ("sys_popen: fork failed: %s\n", strerror(errno)));
 		goto err_exit;
 	}
 
@@ -1216,7 +1227,7 @@ int sys_popen(const char *command)
 
 		ret = execv(argl[0], argl);
 		if (ret == -1) {
-			DEBUG(0, ("sys_popen: ERROR executing dfree command "
+			DEBUG(0, ("sys_popen: ERROR executing command "
 				  "'%s': %s\n", command, strerror(errno)));
 		}
 		_exit (127);
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index cb80e18..e6a0af2 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -95,7 +95,7 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_que
 			return (uint64_t)-1;
 		}
 
-		DEBUG (3, ("disk_free: Running command %s\n", syscmd));
+		DEBUG (3, ("disk_free: Running command '%s'\n", syscmd));
 
 		lines = file_lines_pload(syscmd, NULL);
 		if (lines) {
@@ -123,8 +123,9 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_que
 			if (!*dfree)
 				*dfree = 1024;
 		} else {
-			DEBUG (0, ("disk_free: sys_popen() failed for command %s. Error was : %s\n",
-				syscmd, strerror(errno) ));
+			DEBUG (0, ("disk_free: file_lines_load() failed for "
+				   "command '%s'. Error was : %s\n",
+				   syscmd, strerror(errno) ));
 			if (sys_fsusage(path, dfree, dsize) != 0) {
 				DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
 					strerror(errno) ));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list