From: Zbigniew Jędrzejewski-Szmek Date: Fri, 11 Nov 2016 15:54:54 +0000 (-0500) Subject: basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651) X-Git-Tag: v233~429 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=abd67ce74858491565cde157c7b08fda43d3279c;p=thirdparty%2Fsystemd.git basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651) ENOENT should be treated as "false", but because of the broken errno check it was treated as an error. So ConditionVirtualization=user-namespaces probably returned the correct answer, but only by accident. Fixes #4608. --- diff --git a/src/basic/virt.c b/src/basic/virt.c index 69b0f96183a..d8d57381ad3 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -496,7 +496,7 @@ static int userns_has_mapping(const char *name) { f = fopen(name, "re"); if (!f) { log_debug_errno(errno, "Failed to open %s: %m", name); - return errno == -ENOENT ? false : -errno; + return errno == ENOENT ? false : -errno; } n = getline(&buf, &n_allocated, f);