From: Lennart Poettering Date: Tue, 10 Oct 2017 07:50:23 +0000 (+0200) Subject: namespace: make ns_type_supported() a tiny bit shorter X-Git-Tag: v236~338^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7045%2Fhead;p=thirdparty%2Fsystemd.git 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. --- 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; }