|
|
9119d9 |
From 363794419cbc63754fefc6fc49880bf400daaf1b Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <363794419cbc63754fefc6fc49880bf400daaf1b@dist-git>
|
|
|
9119d9 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Date: Wed, 17 Sep 2014 17:11:03 +0200
|
|
|
9119d9 |
Subject: [PATCH] util: get rid of unnecessary umask() call
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=927369
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit d00c6fd25854bfd4822f6ce3d769a8ca132ec31b)
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/util/virpidfile.c | 10 ++++------
|
|
|
9119d9 |
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
|
|
|
9119d9 |
index dd29701..a3b8846 100644
|
|
|
9119d9 |
--- a/src/util/virpidfile.c
|
|
|
9119d9 |
+++ b/src/util/virpidfile.c
|
|
|
9119d9 |
@@ -545,17 +545,15 @@ virPidFileConstructPath(bool privileged,
|
|
|
9119d9 |
if (virAsprintf(pidfile, "%s/run/%s.pid", statedir, progname) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
} else {
|
|
|
9119d9 |
- mode_t old_umask;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
if (!(rundir = virGetUserRuntimeDirectory()))
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
- old_umask = umask(077);
|
|
|
9119d9 |
- if (virFileMakePath(rundir) < 0) {
|
|
|
9119d9 |
- umask(old_umask);
|
|
|
9119d9 |
+ if (virFileMakePathWithMode(rundir, 0700) < 0) {
|
|
|
9119d9 |
+ virReportSystemError(errno,
|
|
|
9119d9 |
+ _("Cannot create user runtime directory '%s'"),
|
|
|
9119d9 |
+ rundir);
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- umask(old_umask);
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0) {
|
|
|
9119d9 |
VIR_FREE(rundir);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.0
|
|
|
9119d9 |
|