]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: reduce scope of rundir in virPidFileConstructPath()
authorLaine Stump <laine@redhat.com>
Fri, 14 Nov 2025 05:01:32 +0000 (00:01 -0500)
committerLaine Stump <laine@redhat.com>
Mon, 9 Mar 2026 05:29:30 +0000 (01:29 -0400)
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virpidfile.c

index f61caca2de97d231dd1115d5e977d9323bd035c2..dacaffc9297cf4ca899d10dd8550d4fec8c2a685 100644 (file)
@@ -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,