platform/netns: don't try to overlay ro /sys with a rw one

Linux 4.15 won't allow us. No problem.

(cherry picked from commit d7c70dd9ec)
This commit is contained in:
Lubomir Rintel 2018-02-12 18:48:30 +00:00
parent 04a6600a60
commit e7341d219b

View file

@ -475,6 +475,7 @@ nmp_netns_new (void)
NMPNetns *self;
int errsv;
GError *error = NULL;
unsigned long mountflags = 0;
_stack_ensure_init ();
@ -503,7 +504,10 @@ nmp_netns_new (void)
goto err_out;
}
if (mount ("sysfs", "/sys", "sysfs", 0, NULL) != 0) {
if (access ("/sys", W_OK) == -1)
mountflags = MS_RDONLY;
if (mount ("sysfs", "/sys", "sysfs", mountflags, NULL) != 0) {
errsv = errno;
_LOGE (NULL, "failed mount /sys: %s", g_strerror (errsv));
goto err_out;