/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.15 2000/10/12 22:30:31 andersen Exp $
+ * $Id: hostname.c,v 1.20 2001/01/24 18:44:54 andersen Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
if (!isfile) {
if (sethostname(s, strlen(s)) < 0) {
if (errno == EPERM)
- errorMsg("you must be root to change the hostname\n");
+ error_msg_and_die("you must be root to change the hostname\n");
else
- perror("sethostname");
- exit(1);
+ perror_msg_and_die("sethostname");
}
} else {
f = xfopen(s, "r");
fclose(f);
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = 0;
- if (sethostname(buf, strlen(buf)) < 0) {
- perror("sethostname");
- exit(1);
- }
+ if (sethostname(buf, strlen(buf)) < 0)
+ perror_msg_and_die("sethostname");
}
}