30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
From 7d7017a583a014c239cf8f68d484f22f67ca80ac Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Fri, 11 Nov 2016 10:54:54 -0500
|
|
Subject: [PATCH] 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.
|
|
(cherry picked from commit abd67ce74858491565cde157c7b08fda43d3279c)
|
|
---
|
|
src/basic/virt.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/basic/virt.c b/src/basic/virt.c
|
|
index 69b0f96183..d8d57381ad 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);
|