mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user