]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamectl: unset pretty hostname only when no target is specified
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Jan 2021 02:28:06 +0000 (11:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Feb 2021 04:49:27 +0000 (13:49 +0900)
src/hostname/hostnamectl.c

index aaba1deacd4a1d84f3fdbbfa77a3df3af9f148e9..b97411c42bf953ee5b28957c4fc475d32b76d33c 100644 (file)
@@ -267,7 +267,7 @@ static int set_hostname(int argc, char **argv, void *userdata) {
                 /* If the passed hostname is already valid, then assume the user doesn't know anything about pretty
                  * hostnames, so let's unset the pretty hostname, and just set the passed hostname as static/dynamic
                  * hostname. */
-                if (arg_static && hostname_is_valid(hostname, VALID_HOSTNAME_TRAILING_DOT))
+                if (implicit && hostname_is_valid(hostname, VALID_HOSTNAME_TRAILING_DOT))
                         p = ""; /* No pretty hostname (as it is redundant), just a static one */
                 else
                         p = hostname; /* Use the passed name as pretty hostname */