You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.1 KiB
52 lines
2.1 KiB
Index: internet.c |
|
--- internet.c.orig 2000-09-30 19:42:51 +0200 |
|
+++ internet.c 2006-12-19 08:51:18 +0100 |
|
@@ -80,22 +80,19 @@ |
|
if (! isdigit(hostname[0])) { |
|
errno = 0; |
|
host = gethostbyname(hostname); |
|
+ if (host == NULL) fatal(1,"unable to locate IP address/number",NULL); |
|
+ if (host->h_length != sizeof(struct in_addr)) |
|
+ fatal(0,"the address does not seem to be an Internet one",NULL); |
|
+ *address = *((struct in_addr **)host->h_addr_list)[0]; |
|
} else { |
|
- if ((ipaddr = inet_addr(hostname)) == (unsigned long)-1) |
|
+ if(!inet_aton(hostname, address)) |
|
fatal(0,"invalid IP number %s",hostname); |
|
- network_to_address(address,ipaddr); |
|
errno = 0; |
|
- host = gethostbyaddr((void *)address,sizeof(struct in_addr), |
|
- AF_INET); |
|
} |
|
|
|
/* Now clear the timer and check the result. */ |
|
|
|
clear_alarm(); |
|
- if (host == NULL) fatal(1,"unable to locate IP address/number",NULL); |
|
- if (host->h_length != sizeof(struct in_addr)) |
|
- fatal(0,"the address does not seem to be an Internet one",NULL); |
|
- *address = *((struct in_addr **)host->h_addr_list)[0]; |
|
if (memcmp(address,nowhere,sizeof(struct in_addr)) == 0 || |
|
memcmp(address,anywhere,sizeof(struct in_addr)) == 0 || |
|
memcmp(address,everywhere,sizeof(struct in_addr)) == 0) |
|
@@ -103,7 +100,7 @@ |
|
if (verbose) |
|
fprintf(stderr, |
|
"%s: using NTP server %s (%s)\n", |
|
- argv0,host->h_name,inet_ntoa(*address)); |
|
+ argv0,hostname,inet_ntoa(*address)); |
|
} |
|
|
|
/* Find out the port number (usually from /etc/services), and leave it in |
|
Index: unix.c |
|
--- unix.c.orig 2000-10-26 11:57:10 +0200 |
|
+++ unix.c 2006-12-19 08:51:18 +0100 |
|
@@ -81,5 +81,7 @@ |
|
/* Log a message, crudely. This is used in only one place, but could |
|
be used more widely. */ |
|
|
|
- syslog(LOG_DAEMON|LOG_WARNING,"%s",message); |
|
+ openlog("msntp", LOG_PID | LOG_NDELAY, LOG_DAEMON); |
|
+ syslog(LOG_WARNING,"%s",message); |
|
+ closelog(); |
|
}
|
|
|