Skip to content
Commit 7c789948 authored by Yu Watanabe's avatar Yu Watanabe Committed by Zbigniew Jędrzejewski-Szmek
Browse files

hostname-setup: gracefully handle kernel with empty CONFIG_DEFAULT_HOSTNAME

Previously, sethostname_idempotent_full() calls gethostname_full() with
GET_HOSTNAME_ALLOW_NONE and GET_HOSTNAME_ALLOW_LOCALHOST flags. That
intended to get any values set by kernel. But, that does not work, as
the hostname may be empty.

Let's simplify the logic. The function sethostname_idempotent_full()
intends to set the requested hostname only when the current hostname
is different from the requested one. So, no check in getostname_full()
is required. Hence, simply use the result of uname() here.

Fixes #21896.

(cherry picked from commit d8d6b227)
parent 1c4c566d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment