aboutsummaryrefslogtreecommitdiff
path: root/rdate.c
diff options
context:
space:
mode:
Diffstat (limited to 'rdate.c')
-rw-r--r--rdate.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/rdate.c b/rdate.c
index 87edecbfc..03f7f2de3 100644
--- a/rdate.c
+++ b/rdate.c
@@ -47,15 +47,15 @@ time_t askremotedate(char *host)
47 int fd; 47 int fd;
48 48
49 if (!(h = gethostbyname(host))) { /* get the IP addr */ 49 if (!(h = gethostbyname(host))) { /* get the IP addr */
50 error_msg("%s: %s\n", host, strerror(errno)); 50 perror_msg("%s", host);
51 return(-1); 51 return(-1);
52 } 52 }
53 if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ 53 if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
54 error_msg("%s: %s\n", "time", strerror(errno)); 54 perror_msg("%s", "time");
55 return(-1); 55 return(-1);
56 } 56 }
57 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 */
58 error_msg("%s: %s\n", "socket", strerror(errno)); 58 perror_msg("%s", "socket");
59 return(-1); 59 return(-1);
60 } 60 }
61 61
@@ -64,7 +64,7 @@ time_t askremotedate(char *host)
64 sin.sin_family = AF_INET; 64 sin.sin_family = AF_INET;
65 65
66 if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ 66 if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
67 error_msg("%s: %s\n", host, strerror(errno)); 67 perror_msg("%s", host);
68 close(fd); 68 close(fd);
69 return(-1); 69 return(-1);
70 } 70 }
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
123 } 123 }
124 if (setdate) { 124 if (setdate) {
125 if (stime(&time) < 0) 125 if (stime(&time) < 0)
126 error_msg_and_die("Could not set time of day: %s\n", strerror(errno)); 126 perror_msg_and_die("Could not set time of day");
127 } 127 }
128 if (printdate) { 128 if (printdate) {
129 fprintf(stdout, "%s", ctime(&time)); 129 fprintf(stdout, "%s", ctime(&time));