[svn-commits] tilghman: branch 1.6.2 r272927 - in /branches/1.6.2: ./ main/asterisk.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 28 16:51:56 CDT 2010


Author: tilghman
Date: Mon Jun 28 16:51:52 2010
New Revision: 272927

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=272927
Log:
Merged revisions 272926 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r272926 | tilghman | 2010-06-28 16:50:57 -0500 (Mon, 28 Jun 2010) | 15 lines
  
  Merged revisions 272925 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r272925 | tilghman | 2010-06-28 16:50:02 -0500 (Mon, 28 Jun 2010) | 8 lines
    
    Don't change ownership/group/permissions on run directory, if it already exists.
    
    (closes issue #17076)
     Reported by: stuarth
     Patches: 
           20100324__issue17076.diff.txt uploaded by tilghman (license 14)
     Tested by: stuarth
  ........
................

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/asterisk.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=272927&r1=272926&r2=272927
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Mon Jun 28 16:51:52 2010
@@ -3134,7 +3134,7 @@
 	FILE *f;
 	sigset_t sigs;
 	int num;
-	int isroot = 1;
+	int isroot = 1, rundir_exists = 0;
 	char *buf;
 	const char *runuser = NULL, *rungroup = NULL;
 	char *remotesock = NULL;
@@ -3334,8 +3334,12 @@
 
 	/* It's common on some platforms to clear /var/run at boot.  Create the
 	 * socket file directory before we drop privileges. */
-	if (mkdir(ast_config_AST_RUN_DIR, 0755) && errno != EEXIST) {
-		ast_log(LOG_WARNING, "Unable to create socket file directory.  Remote consoles will not be able to connect! (%s)\n", strerror(x));
+	if (mkdir(ast_config_AST_RUN_DIR, 0755)) {
+		if (errno == EEXIST) {
+			rundir_exists = 1;
+		} else {
+			ast_log(LOG_WARNING, "Unable to create socket file directory.  Remote consoles will not be able to connect! (%s)\n", strerror(x));
+		}
 	}
 
 #ifndef __CYGWIN__
@@ -3351,7 +3355,7 @@
 			ast_log(LOG_WARNING, "No such group '%s'!\n", rungroup);
 			exit(1);
 		}
-		if (chown(ast_config_AST_RUN_DIR, -1, gr->gr_gid)) {
+		if (!rundir_exists && chown(ast_config_AST_RUN_DIR, -1, gr->gr_gid)) {
 			ast_log(LOG_WARNING, "Unable to chgrp run directory to %d (%s)\n", (int) gr->gr_gid, rungroup);
 		}
 		if (setgid(gr->gr_gid)) {




More information about the svn-commits mailing list