gethostname: Tighten up error messages slightly, switch to default "y".
diff --git a/toys/lsb/hostname.c b/toys/lsb/hostname.c
index e64f4ff..bd31918 100644
--- a/toys/lsb/hostname.c
+++ b/toys/lsb/hostname.c
@@ -10,7 +10,7 @@
config HOSTNAME
bool "hostname"
- default n
+ default y
help
usage: hostname [newname]
@@ -24,10 +24,10 @@
const char *hostname = toys.optargs[0];
if (hostname) {
if (sethostname(hostname, strlen(hostname)))
- perror_exit("cannot set hostname to '%s'", hostname);
+ perror_exit("set failed '%s'", hostname);
} else {
if (gethostname(toybuf, sizeof(toybuf)))
- perror_exit("cannot get hostname");
+ perror_exit("get failed");
xputs(toybuf);
}
}