[PATCH 2/8] util: reduce scope of rundir in virPidFileConstructPath()

Laine Stump via Devel posted 8 patches 6 days, 18 hours ago
[PATCH 2/8] util: reduce scope of rundir in virPidFileConstructPath()
Posted by Laine Stump via Devel 6 days, 18 hours ago
From: Laine Stump <laine@redhat.com>

Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/util/virpidfile.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index f61caca2de..dacaffc929 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -526,8 +526,6 @@ virPidFileConstructPath(bool privileged,
                         const char *progname,
                         char **pidfile)
 {
-    g_autofree char *rundir = NULL;
-
     if (privileged) {
         /*
          * This is here just to allow calling this function with
@@ -540,7 +538,7 @@ virPidFileConstructPath(bool privileged,
         }
         *pidfile = g_strdup_printf("%s/%s.pid", runstatedir, progname);
     } else {
-        rundir = virGetUserRuntimeDirectory();
+        g_autofree char *rundir = virGetUserRuntimeDirectory();
 
         if (g_mkdir_with_parents(rundir, 0700) < 0) {
             virReportSystemError(errno,
-- 
2.52.0