[PATCH 2/4] vircgroupmock: Make global variables static

Michal Privoznik mprivozn at redhat.com
Fri Mar 4 09:31:59 UTC 2022

Apparently clang was fixed as it no longer considers having
global variables static a problem. Make the variables static to
be sure they aren't used outside of the source file.

This effectively reverts v1.0.6-rc1~198 which started the trend.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
 tests/vircgroupmock.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index cbf5269df6..a213c8e686 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -36,14 +36,10 @@ static FILE *(*real_fopen)(const char *path, const char *mode);
 static int (*real_access)(const char *path, int mode);
 static int (*real_mkdir)(const char *path, mode_t mode);
-/* Don't make static, since it causes problems with clang
- * when passed as an arg to asprintf()
- * vircgroupmock.c:462:22: error: static variable 'fakesysfsdir' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
- */
-char *fakerootdir;
-char *fakesysfscgroupdir;
-const char *fakedevicedir0 = FAKEDEVDIR0;
-const char *fakedevicedir1 = FAKEDEVDIR1;
+static char *fakerootdir;
+static char *fakesysfscgroupdir;
+static const char *fakedevicedir0 = FAKEDEVDIR0;
+static const char *fakedevicedir1 = FAKEDEVDIR1;
 # define SYSFS_CGROUP_PREFIX "/not/really/sys/fs/cgroup"

More information about the libvir-list mailing list