diff options
Diffstat (limited to 'src/platform/tests/test-common.c')
-rw-r--r-- | src/platform/tests/test-common.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index 1050e1ce6f..98280b4527 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -965,19 +965,21 @@ main (int argc, char **argv) /* Create a writable /sys/devices tree. This makes it possible to run tests * that modify values via sysfs (such as bridge forward delay). */ - if (mount ("sys", "/sys/devices", "sysfs", 0, NULL) == 0) { - if (mount (NULL, "/sys/devices", "sysfs", MS_REMOUNT, NULL) != 0) { - /* Read-write remount failed. Never mind, we're probably just a root in - * our user NS. */ - if (umount ("/sys/devices") != 0) { - errsv = errno; - g_error ("umount(\"/sys/devices\") failed with %s (%d)", strerror (errsv), errsv); - } - } else { - if (mount ("/sys/devices/devices", "/sys/devices", "sysfs", MS_BIND, NULL) != 0) { - errsv = errno; - g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv); - } + if (mount ("sys", "/sys/devices", "sysfs", 0, NULL) != 0) { + errsv = errno; + g_error ("mount(\"/sys/devices\") failed with %s (%d)", strerror (errsv), errsv); + } + if (mount (NULL, "/sys/devices", "sysfs", MS_REMOUNT, NULL) != 0) { + /* Read-write remount failed. Never mind, we're probably just a root in + * our user NS. */ + if (umount ("/sys/devices") != 0) { + errsv = errno; + g_error ("umount(\"/sys/devices\") failed with %s (%d)", strerror (errsv), errsv); + } + } else { + if (mount ("/sys/devices/devices", "/sys/devices", "sysfs", MS_BIND, NULL) != 0) { + errsv = errno; + g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv); } } } |