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:
@@ -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)") ||
|
||||
|
||||
Reference in New Issue
Block a user