aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-10-01 17:52:14 +0000
committerMatt Kraai <kraai@debian.org>2001-10-01 17:52:14 +0000
commitc9fc633f9ed09143a63f62f26b0afb619a31273c (patch)
treef2ddb19d9aa993a616c69dff143f5bad18205076
parent524fcb9e01b6aa48334bfd6470045a0f3591cae9 (diff)
downloadbusybox-w32-c9fc633f9ed09143a63f62f26b0afb619a31273c.tar.gz
busybox-w32-c9fc633f9ed09143a63f62f26b0afb619a31273c.tar.bz2
busybox-w32-c9fc633f9ed09143a63f62f26b0afb619a31273c.zip
Use port 37 by default.
-rw-r--r--rdate.c12
-rw-r--r--util-linux/rdate.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/rdate.c b/rdate.c
index 50be4de8c..04a76129a 100644
--- a/rdate.c
+++ b/rdate.c
@@ -46,17 +46,17 @@ static time_t askremotedate(const char *host)
46 int fd; 46 int fd;
47 47
48 h = xgethostbyname(host); /* get the IP addr */ 48 h = xgethostbyname(host); /* get the IP addr */
49 memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr));
50
51 s_in.sin_port = htons(37); /* find port # */
52 if ((tserv = getservbyname("time", "tcp")) != NULL)
53 s_in.sin_port = tserv->s_port;
49 54
50 if ((tserv = getservbyname("time", "tcp")) == NULL) /* find port # */ 55 s_in.sin_family = AF_INET;
51 perror_msg_and_die("time");
52 56
53 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ 57 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */
54 perror_msg_and_die("socket"); 58 perror_msg_and_die("socket");
55 59
56 memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr));
57 s_in.sin_port= tserv->s_port;
58 s_in.sin_family = AF_INET;
59
60 if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */ 60 if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */
61 perror_msg_and_die("%s", host); 61 perror_msg_and_die("%s", host);
62 62
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 50be4de8c..04a76129a 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -46,17 +46,17 @@ static time_t askremotedate(const char *host)
46 int fd; 46 int fd;
47 47
48 h = xgethostbyname(host); /* get the IP addr */ 48 h = xgethostbyname(host); /* get the IP addr */
49 memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr));
50
51 s_in.sin_port = htons(37); /* find port # */
52 if ((tserv = getservbyname("time", "tcp")) != NULL)
53 s_in.sin_port = tserv->s_port;
49 54
50 if ((tserv = getservbyname("time", "tcp")) == NULL) /* find port # */ 55 s_in.sin_family = AF_INET;
51 perror_msg_and_die("time");
52 56
53 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ 57 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */
54 perror_msg_and_die("socket"); 58 perror_msg_and_die("socket");
55 59
56 memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr));
57 s_in.sin_port= tserv->s_port;
58 s_in.sin_family = AF_INET;
59
60 if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */ 60 if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */
61 perror_msg_and_die("%s", host); 61 perror_msg_and_die("%s", host);
62 62