render / rpms / libvirt

Forked from rpms/libvirt 5 months ago
Clone
c480ed
From bbb7b7a4cb906bdeaf46ab664ce67a0a27b9ef5d Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <bbb7b7a4cb906bdeaf46ab664ce67a0a27b9ef5d@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:07:54 +0200
c480ed
Subject: [PATCH] vircgroupmock: change cgroup prefix
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
Remove the trailing '/' from prefix.  This change is required in order
c480ed
to introduce tests for unified cgroups.  They are usually mounted in
c480ed
'/sys/fs/cgroup'.
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
(cherry picked from commit 9bd1979e37ca703f8e29c2dfca83a9cd04af2982)
c480ed
c480ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Message-Id: <cdff08c2966b44ad1c3c7d166fc39c20f4bd0ba2.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 tests/vircgroupmock.c | 16 ++++++++--------
c480ed
 1 file changed, 8 insertions(+), 8 deletions(-)
c480ed
c480ed
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
c480ed
index 3afe2fe192..fcc00a7a7b 100644
c480ed
--- a/tests/vircgroupmock.c
c480ed
+++ b/tests/vircgroupmock.c
c480ed
@@ -58,7 +58,7 @@ const char *fakedevicedir0 = FAKEDEVDIR0;
c480ed
 const char *fakedevicedir1 = FAKEDEVDIR1;
c480ed
 
c480ed
 
c480ed
-# define SYSFS_CGROUP_PREFIX "/not/really/sys/fs/cgroup/"
c480ed
+# define SYSFS_CGROUP_PREFIX "/not/really/sys/fs/cgroup"
c480ed
 # define SYSFS_CPU_PRESENT "/sys/devices/system/cpu/present"
c480ed
 # define SYSFS_CPU_PRESENT_MOCKED "devices_system_cpu_present"
c480ed
 
c480ed
@@ -356,7 +356,7 @@ int access(const char *path, int mode)
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
         char *newpath;
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -388,7 +388,7 @@ int __lxstat(int ver, const char *path, struct stat *sb)
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
         char *newpath;
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -419,7 +419,7 @@ int lstat(const char *path, struct stat *sb)
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
         char *newpath;
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -450,7 +450,7 @@ int __xstat(int ver, const char *path, struct stat *sb)
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
         char *newpath;
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -489,7 +489,7 @@ int stat(const char *path, struct stat *sb)
c480ed
         }
c480ed
     } else if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -521,7 +521,7 @@ int mkdir(const char *path, mode_t mode)
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
         char *newpath;
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
@@ -554,7 +554,7 @@ int open(const char *path, int flags, ...)
c480ed
 
c480ed
     if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
c480ed
         init_sysfs();
c480ed
-        if (asprintf(&newpath, "%s/%s",
c480ed
+        if (asprintf(&newpath, "%s%s",
c480ed
                      fakesysfscgroupdir,
c480ed
                      path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
c480ed
             errno = ENOMEM;
c480ed
-- 
c480ed
2.22.0
c480ed