diff options
Diffstat (limited to 'hostname.c')
-rw-r--r-- | hostname.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/hostname.c b/hostname.c index 13e52c41d..c64d1602b 100644 --- a/hostname.c +++ b/hostname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw Exp $ | 3 | * $Id: hostname.c,v 1.17 2000/12/22 01:48:07 kraai Exp $ |
4 | * Mini hostname implementation for busybox | 4 | * Mini hostname implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -40,10 +40,9 @@ void do_sethostname(char *s, int isfile) | |||
40 | if (!isfile) { | 40 | if (!isfile) { |
41 | if (sethostname(s, strlen(s)) < 0) { | 41 | if (sethostname(s, strlen(s)) < 0) { |
42 | if (errno == EPERM) | 42 | if (errno == EPERM) |
43 | error_msg("you must be root to change the hostname\n"); | 43 | error_msg_and_die("you must be root to change the hostname\n"); |
44 | else | 44 | else |
45 | perror("sethostname"); | 45 | perror_msg_and_die("sethostname"); |
46 | exit(1); | ||
47 | } | 46 | } |
48 | } else { | 47 | } else { |
49 | f = xfopen(s, "r"); | 48 | f = xfopen(s, "r"); |
@@ -51,10 +50,8 @@ void do_sethostname(char *s, int isfile) | |||
51 | fclose(f); | 50 | fclose(f); |
52 | if (buf[strlen(buf) - 1] == '\n') | 51 | if (buf[strlen(buf) - 1] == '\n') |
53 | buf[strlen(buf) - 1] = 0; | 52 | buf[strlen(buf) - 1] = 0; |
54 | if (sethostname(buf, strlen(buf)) < 0) { | 53 | if (sethostname(buf, strlen(buf)) < 0) |
55 | perror("sethostname"); | 54 | perror_msg_and_die("sethostname"); |
56 | exit(1); | ||
57 | } | ||
58 | } | 55 | } |
59 | } | 56 | } |
60 | 57 | ||