hostname-setup: do not trigger assertion when uname() is prohibited by seccomp

gethostname_full() is used in nss-myhostname, and hence random
application may indirectly call it. When an application with a too strict
seccomp filter loads the nss module, the application may trigger the
assertion.

Partially fixes #38582.
This commit is contained in:
Yu Watanabe
2025-08-17 00:14:42 +09:00
parent b8c78d3331
commit 45079ae1e6
+2 -1
View File
@@ -316,7 +316,8 @@ int gethostname_full(GetHostnameFlags flags, char **ret) {
assert(ret);
assert_se(uname(&u) >= 0);
if (uname(&u) < 0)
return -errno;
s = u.nodename;
if (isempty(s) || streq(s, "(none)") ||