]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
namepace: fix error handling when clone_device_node() returns 0 7971/head
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 18:37:59 +0000 (19:37 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 18:50:32 +0000 (19:50 +0100)
Before this patch, we'd treat clone_device_node() returning 0 (as
opposed to 1) as error, but then propagate this non-error result in
confusion.

This makes sure that if we ptmx isn't around we propagate that as
-ENXIO.

This is a follow-up for 98b1d2b8d9ea27087a5980b4b902b6a6ab716e03

src/core/namespace.c

index 565b9544825dd73966303c1694bd30bf3e1da3ab..70089f212a57570f26891f942b3adbb4b65f51db 100644 (file)
@@ -578,8 +578,12 @@ static int mount_private_dev(MountEntry *m) {
                 }
         } else {
                 r = clone_device_node("/dev/ptmx", temporary_mount);
-                if (r != 1)
+                if (r < 0)
+                        goto fail;
+                if (r == 0) {
+                        r = -ENXIO;
                         goto fail;
+                }
         }
 
         devshm = strjoina(temporary_mount, "/dev/shm");