main: create NMSTATEDIR with permissions 700
authorThomas Haller <thaller@redhat.com>
Mon, 21 Mar 2016 10:40:42 +0000 (11:40 +0100)
committerThomas Haller <thaller@redhat.com>
Mon, 21 Mar 2016 10:41:51 +0000 (11:41 +0100)
"NMSTATEDIR" is "nmstatedir" is "'${localstatedir}'/lib/$PACKAGE" is
usually "/var/lib/NetworkManager".

The "install-data-hook" in "src/Makefile.am" properly installs the
directory with permissions 700. When creating the directory at startup,
we must also use those permissions.

src/main.c

index bf00700..bf1224d 100644 (file)
@@ -310,7 +310,7 @@ main (int argc, char *argv[])
        nm_main_utils_ensure_not_running_pidfile (global_opt.pidfile);
 
        /* Ensure state directory exists */
-       if (g_mkdir_with_parents (NMSTATEDIR, 0755) != 0) {
+       if (g_mkdir_with_parents (NMSTATEDIR, 0700) != 0) {
                fprintf (stderr, "Cannot create '%s': %s", NMSTATEDIR, strerror (errno));
                exit (1);
        }