summaryrefslogtreecommitdiff
path: root/src/firstboot
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-08-05 21:01:06 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-08-05 21:02:41 -0400
commit73974f6768ef5314a572eb93f5cfc7f0f29c9549 (patch)
treee95c0a5626290c79e7c31ac143e6c75a0f167d9d /src/firstboot
parent4306d66f594722a2fe44b034d3c68bfb864c6a76 (diff)
parent90365b043ab6a0d8100e0c37dea4ca9d6fdb4695 (diff)
Merge branch 'hostnamectl-dot-v2'
Manual merge of https://github.com/systemd/systemd/pull/751.
Diffstat (limited to 'src/firstboot')
-rw-r--r--src/firstboot/firstboot.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index c526a85b05..e2a1c00a75 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -386,12 +386,13 @@ static int prompt_hostname(void) {
break;
}
- if (!hostname_is_valid(h)) {
+ if (!hostname_is_valid(h, true)) {
log_error("Specified hostname invalid.");
continue;
}
- arg_hostname = h;
+ /* Get rid of the trailing dot that we allow, but don't want to see */
+ arg_hostname = hostname_cleanup(h);
h = NULL;
break;
}
@@ -772,11 +773,12 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_HOSTNAME:
- if (!hostname_is_valid(optarg)) {
+ if (!hostname_is_valid(optarg, true)) {
log_error("Host name %s is not valid.", optarg);
return -EINVAL;
}
+ hostname_cleanup(optarg);
r = free_and_strdup(&arg_hostname, optarg);
if (r < 0)
return log_oom();