From 0fa5b8312abfe3eff7e45f58619276917e597815 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 10 Oct 2017 09:50:23 +0200 Subject: [PATCH] namespace: make ns_type_supported() a tiny bit shorter namespace_type_to_string() already validates the type paramater, we can use that, and shorten the function a bit. --- src/core/namespace.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index ac5fde16f41..9624d8aa69d 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1431,12 +1431,11 @@ fail: bool ns_type_supported(NamespaceType type) { const char *t, *ns_proc; - if (type <= _NAMESPACE_TYPE_INVALID || type >= _NAMESPACE_TYPE_MAX) + t = namespace_type_to_string(type); + if (!t) /* Don't know how to translate this? Then it's not supported */ return false; - t = namespace_type_to_string(type); ns_proc = strjoina("/proc/self/ns/", t); - return access(ns_proc, F_OK) == 0; } -- 2.47.3