diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-28 21:50:57 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-28 21:50:57 +0000 |
commit | db212ff9112321b89765d1d3f64df399e7a8edbc (patch) | |
tree | a9478c0c53a5ca379c21dc3d41a639b8d5b6d448 /main | |
parent | 11396a47870d57492893cb1092f4c0b6949e2029 (diff) |
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
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@272926 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 66967f515..0fd171169 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -3156,7 +3156,7 @@ int main(int argc, char *argv[]) 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; @@ -3366,8 +3366,12 @@ int main(int argc, char *argv[]) /* 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__ @@ -3383,7 +3387,7 @@ int main(int argc, char *argv[]) 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)) { |