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