summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2006-05-02 18:32:08 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2006-05-02 18:32:08 +0000
commit8495a95f305e28c85d7249931c43d1b3a2efad39 (patch)
tree5f41d629af5000b3d937c5f738a480f0206e3b67
parentf9b5f2b5e243462ca3de1420347a82aeadbda979 (diff)
downloadsrc-test-8495a95f305e28c85d7249931c43d1b3a2efad39.tar.gz
src-test-8495a95f305e28c85d7249931c43d1b3a2efad39.zip
MFC: v1.45, v1.44
Make port 37 time work on machines with 64 bit longs. Also merge a couple of updates to comments. Approved by: re
Notes
Notes: svn path=/stable/5/; revision=158250
-rw-r--r--usr.sbin/inetd/builtins.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c
index 96eeb3357fa48..ad7a82e479b78 100644
--- a/usr.sbin/inetd/builtins.c
+++ b/usr.sbin/inetd/builtins.c
@@ -64,7 +64,7 @@ static int getline(int, char *, int);
void iderror(int, int, int, const char *);
void ident_stream(int, struct servtab *);
void initring(void);
-unsigned long machtime(void);
+uint32_t machtime(void);
void machtime_dg(int, struct servtab *);
void machtime_stream(int, struct servtab *);
@@ -117,7 +117,10 @@ initring(void)
*endring++ = i;
}
-/* Character generator */
+/* Character generator
+ * The RFC says that we should send back a random number of
+ * characters chosen from the range 0 to 512. We send LINESIZ+2.
+ */
/* ARGSUSED */
void
chargen_dg(int s, struct servtab *sep)
@@ -677,7 +680,7 @@ printit:
}
/*
- * RFC738 Time Server.
+ * RFC738/868 Time Server.
* Return a machine readable date and time, in the form of the
* number of seconds since midnight, Jan 1, 1900. Since gettimeofday
* returns the number of seconds since midnight, Jan 1, 1970,
@@ -685,7 +688,7 @@ printit:
* some seventy years Bell Labs was asleep.
*/
-unsigned long
+uint32_t
machtime(void)
{
struct timeval tv;
@@ -695,8 +698,8 @@ machtime(void)
warnx("unable to get time of day");
return (0L);
}
-#define OFFSET ((u_long)25567 * 24*60*60)
- return (htonl((long)(tv.tv_sec + OFFSET)));
+#define OFFSET ((uint32_t)25567 * 24*60*60)
+ return (htonl((uint32_t)(tv.tv_sec + OFFSET)));
#undef OFFSET
}
@@ -704,7 +707,7 @@ machtime(void)
void
machtime_dg(int s, struct servtab *sep)
{
- unsigned long result;
+ uint32_t result;
struct sockaddr_storage ss;
socklen_t size;
@@ -725,7 +728,7 @@ machtime_dg(int s, struct servtab *sep)
void
machtime_stream(int s, struct servtab *sep __unused)
{
- unsigned long result;
+ uint32_t result;
result = machtime();
(void) send(s, (char *) &result, sizeof(result), MSG_EOF);