]> git.pld-linux.org Git - packages/ntp.git/blob - ntp-usegethost.patch
- run ntpdate also from cron
[packages/ntp.git] / ntp-usegethost.patch
1 --- ntp-4.0.99k/ntpdate/ntptime_config.c.usegethost     Tue Feb  6 15:11:04 2001
2 +++ ntp-4.0.99k/ntpdate/ntptime_config.c        Tue Feb  6 15:11:31 2001
3 @@ -19,6 +19,8 @@
4  #include <signal.h>
5  #include <ctype.h>
6  #include <sys/time.h>
7 +#include <netdb.h>
8 +#include <arpa/inet.h>
9  
10  #include "ntp_fp.h"
11  #include "ntp.h"
12 @@ -156,10 +158,12 @@
13         int srvcnt;
14         /* u_long peerkey; */
15         int peerflags;
16 +       struct hostent *hp;
17         struct sockaddr_in peeraddr;
18         FILE *fp;
19         char line[MAXLINE];
20         char *(tokens[MAXTOKENS]);
21 +       char *host_string;
22         int ntokens;
23         int tok;
24         const char *config_file;
25 @@ -238,8 +242,13 @@
26                                         tokens[0]);
27                                 break;
28                         }
29 -                       
30 -                       if (!getnetnum(tokens[1], &peeraddr, 1)) {
31 +
32 +                       host_string = tokens[1];
33 +                       if ((hp = gethostbyname(tokens[1])) != NULL) {
34 +                         host_string = inet_ntoa(*(struct in_addr *) hp->h_addr);
35 +                       }
36 +
37 +                       if (!getnetnum(host_string, &peeraddr, 1)) {
38                                 /* Resolve now, or lose! */
39                                 break;
40                         } else {
This page took 0.097835 seconds and 3 git commands to generate.