From 09caeadeda450ecf3f34f8aa556c614a18ecb4fb Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 3 Jun 1998 20:01:28 +0000 Subject: Use gethostname(3) to obtain the local host name, as opposed to uname(3). Otherwise the length of the name is limited to 32 characters only. --- libexec/bootpd/bootpd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libexec') diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c index 0fe07e1b7dd4..68e35d50223a 100644 --- a/libexec/bootpd/bootpd.c +++ b/libexec/bootpd/bootpd.c @@ -19,7 +19,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - $Id: bootpd.c,v 1.6 1997/02/22 14:21:02 peter Exp $ + $Id: bootpd.c,v 1.7 1997/05/11 14:27:03 phk Exp $ ************************************************************************/ @@ -162,8 +162,7 @@ char *progname; char *chdir_path; struct in_addr my_ip_addr; -struct utsname my_uname; -char *hostname; +char *hostname, default_hostname[MAXHOSTNAMELEN + 1]; /* Flags set by signal catcher. */ PRIVATE int do_readtab = 0; @@ -256,11 +255,11 @@ main(argc, argv) stmp = NULL; timeout = &actualtimeout; - if (uname(&my_uname) < 0) { + if (gethostname(default_hostname, MAXHOSTNAMELEN) < 0) { report(LOG_ERR, "bootpd: can't get hostname\n"); exit(1); } - hostname = my_uname.nodename; + hostname = default_hostname; /* * Read switches. -- cgit v1.3