]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virpcimock: Rename @fakesysfspcidir
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Aug 2019 08:44:53 +0000 (10:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Sat, 17 Aug 2019 09:32:31 +0000 (11:32 +0200)
We will need to create more directories and instead of
introducing bunch of new variables to hold their actual
paths, we can have one and reuse it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
tests/virpcimock.c

index f4c2876f3f3826e318c9be917dbd4f0e38550405..93275648dc8cb48c1f8d113c1c8ebbc6ac84e9c6 100644 (file)
@@ -833,7 +833,7 @@ init_syms(void)
 static void
 init_env(void)
 {
-    VIR_AUTOFREE(char *) fakesysfspcidir = NULL;
+    VIR_AUTOFREE(char *) tmp = NULL;
 
     if (fakerootdir)
         return;
@@ -841,14 +841,14 @@ init_env(void)
     if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))
         ABORT("Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
 
-    if (virAsprintfQuiet(&fakesysfspcidir, "%s%s",
+    if (virAsprintfQuiet(&tmp, "%s%s",
                          fakerootdir, SYSFS_PCI_PREFIX) < 0)
         ABORT_OOM();
 
-    if (virFileMakePath(fakesysfspcidir) < 0)
-        ABORT("Unable to create: %s", fakesysfspcidir);
+    if (virFileMakePath(tmp) < 0)
+        ABORT("Unable to create: %s", tmp);
 
-    make_file(fakesysfspcidir, "drivers_probe", NULL, -1);
+    make_file(tmp, "drivers_probe", NULL, -1);
 
 # define MAKE_PCI_DRIVER(name, ...) \
     pci_driver_new(name, 0, __VA_ARGS__, -1, -1)