]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
conf: create socket directory before logdir and dumpdir
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 11 Nov 2016 12:07:28 +0000 (13:07 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Nov 2016 13:55:25 +0000 (14:55 +0100)
This allows sharing of the same directory for sockets, logs and dumps as
the socket directory needs to be created first (with mode 0770) in order
to pass the check of the permissions.

conf.c

diff --git a/conf.c b/conf.c
index c255c24ad54813d1a42a21b1900617b00a844992..d63b6830e0c0201ddaf34d9ca4045b7931831da5 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -1268,11 +1268,6 @@ CNF_CreateDirs(uid_t uid, gid_t gid)
 {
   char *dir;
 
-  if (logdir[0])
-    UTI_CreateDirAndParents(logdir, 0755, uid, gid);
-  if (dumpdir[0])
-    UTI_CreateDirAndParents(dumpdir, 0755, uid, gid);
-
   /* Create a directory for the Unix domain command socket */
   if (bind_cmd_path[0]) {
     dir = UTI_PathToDir(bind_cmd_path);
@@ -1288,6 +1283,11 @@ CNF_CreateDirs(uid_t uid, gid_t gid)
 
     Free(dir);
   }
+
+  if (logdir[0])
+    UTI_CreateDirAndParents(logdir, 0755, uid, gid);
+  if (dumpdir[0])
+    UTI_CreateDirAndParents(dumpdir, 0755, uid, gid);
 }
 
 /* ================================================== */