]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: get rid of unnecessary umask() call
authorMartin Kletzander <mkletzan@redhat.com>
Sun, 7 Sep 2014 18:09:36 +0000 (20:09 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 15 Sep 2014 07:49:34 +0000 (09:49 +0200)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/util/virpidfile.c

index dd29701a757a83bf6eeaf28cc2978aa7516f529f..a3b8846aae44d7924ffe046baaa6118af5c1883c 100644 (file)
@@ -545,17 +545,15 @@ virPidFileConstructPath(bool privileged,
         if (virAsprintf(pidfile, "%s/run/%s.pid", statedir, progname) < 0)
             goto cleanup;
     } else {
-        mode_t old_umask;
-
         if (!(rundir = virGetUserRuntimeDirectory()))
             goto cleanup;
 
-        old_umask = umask(077);
-        if (virFileMakePath(rundir) < 0) {
-            umask(old_umask);
+        if (virFileMakePathWithMode(rundir, 0700) < 0) {
+            virReportSystemError(errno,
+                                 _("Cannot create user runtime directory '%s'"),
+                                 rundir);
             goto cleanup;
         }
-        umask(old_umask);
 
         if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0) {
             VIR_FREE(rundir);