render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
a54075
From 51ceb3ceaa2f192a0612b9a794d3282a059d2c9d Mon Sep 17 00:00:00 2001
a54075
From: Martin Kletzander <mkletzan@redhat.com>
a54075
Date: Sun, 7 Sep 2014 20:09:36 +0200
a54075
Subject: [PATCH] util: get rid of unnecessary umask() call
a54075
a54075
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
a54075
(cherry picked from commit d00c6fd25854bfd4822f6ce3d769a8ca132ec31b)
a54075
---
a54075
 src/util/virpidfile.c | 10 ++++------
a54075
 1 file changed, 4 insertions(+), 6 deletions(-)
a54075
a54075
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
a54075
index dd29701..a3b8846 100644
a54075
--- a/src/util/virpidfile.c
a54075
+++ b/src/util/virpidfile.c
a54075
@@ -545,17 +545,15 @@ virPidFileConstructPath(bool privileged,
a54075
         if (virAsprintf(pidfile, "%s/run/%s.pid", statedir, progname) < 0)
a54075
             goto cleanup;
a54075
     } else {
a54075
-        mode_t old_umask;
a54075
-
a54075
         if (!(rundir = virGetUserRuntimeDirectory()))
a54075
             goto cleanup;
a54075
 
a54075
-        old_umask = umask(077);
a54075
-        if (virFileMakePath(rundir) < 0) {
a54075
-            umask(old_umask);
a54075
+        if (virFileMakePathWithMode(rundir, 0700) < 0) {
a54075
+            virReportSystemError(errno,
a54075
+                                 _("Cannot create user runtime directory '%s'"),
a54075
+                                 rundir);
a54075
             goto cleanup;
a54075
         }
a54075
-        umask(old_umask);
a54075
 
a54075
         if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0) {
a54075
             VIR_FREE(rundir);