OSDN Git Service

gethostname: Tighten up error messages slightly, switch to default "y".
authorRob Landley <rob@landley.net>
Sun, 9 Sep 2012 23:44:12 +0000 (18:44 -0500)
committerRob Landley <rob@landley.net>
Sun, 9 Sep 2012 23:44:12 +0000 (18:44 -0500)
toys/lsb/hostname.c

index e64f4ff..bd31918 100644 (file)
@@ -10,7 +10,7 @@ USE_HOSTNAME(NEWTOY(hostname, NULL, TOYFLAG_BIN))
 
 config HOSTNAME
        bool "hostname"
-       default n
+       default y
        help
          usage: hostname [newname]
 
@@ -24,10 +24,10 @@ void hostname_main(void)
        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);
         }
 }