]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
main: create directories before writing pidfile
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 7 Jun 2018 14:43:59 +0000 (16:43 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 8 Jun 2018 14:42:49 +0000 (16:42 +0200)
This makes it possible to save pidfile in /var/run/chrony.

main.c

diff --git a/main.c b/main.c
index a2202e993ad1f559209a4211f5a3a8b5b9d8387e..e538cc5b1de354070879693a191810785bb6ef2f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -530,9 +530,6 @@ int main
   /* Check whether another chronyd may already be running */
   check_pidfile();
 
-  /* Write our pidfile to prevent other chronyds running */
-  write_pidfile();
-
   if (!user)
     user = CNF_GetUser();
 
@@ -543,6 +540,9 @@ int main
   /* Create directories for sockets, log files, and dump files */
   CNF_CreateDirs(pw->pw_uid, pw->pw_gid);
 
+  /* Write our pidfile to prevent other instances from running */
+  write_pidfile();
+
   PRV_Initialise();
   LCL_Initialise();
   SCH_Initialise();