]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
util: don't try to create current directory
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Aug 2015 14:53:02 +0000 (16:53 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Aug 2015 16:07:39 +0000 (18:07 +0200)
This prevents error messages when running chronyd -d/-q/-Q with default
logdir in a directory chronyd is not allowed do access after dropping
the root privileges.

util.c

diff --git a/util.c b/util.c
index 82bb46a1e8f05c9cf4cf6c40f0ca9d110e5e6e73..89379d9c4df13a6ebbb2505bb3f2591537c42701 100644 (file)
--- a/util.c
+++ b/util.c
@@ -931,6 +931,10 @@ UTI_CreateDirAndParents(const char *path)
   char *p;
   int i, j, k, last;
 
+  /* Don't try to create current directory */
+  if (!strcmp(path, "."))
+    return 1;
+
   p = (char *)Malloc(1 + strlen(path));
 
   i = k = 0;