1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--- netkit-rwho-0.17-org/rwhod/rwhod.c Sat Jul 22 21:19:48 2000
+++ netkit-rwho-0.17/rwhod/rwhod.c Sat Jul 6 11:53:50 2002
@@ -69,6 +69,7 @@
#include <arpa/inet.h>
#include <pwd.h>
#include <grp.h>
+#include <time.h>
#include "daemon.h"
@@ -95,7 +96,7 @@
static void broadcaster(void);
static int configure(int s);
static int verify(const char *name);
-static int getloadavg(double ptr[3], int n);
+int getloadavg(double ptr[3], int n);
/*
* We communicate with each neighbor in
@@ -273,7 +274,7 @@
wd.wd_hostname[sizeof(wd.wd_hostname)-1] = 0;
if (!verify(wd.wd_hostname)) {
syslog(LOG_WARNING, "malformed host name from %x",
- from.sin_addr);
+ from.sin_addr.s_addr);
continue;
}
snprintf(path, sizeof(path), "whod.%s", wd.wd_hostname);
@@ -359,9 +360,9 @@
*cp = '\0';
mynamelen = strlen(myname);
if (mynamelen > sizeof(mywd.wd_hostname))
- mynamelen = sizeof(mywd.wd_hostname);
+ mynamelen = sizeof(mywd.wd_hostname) - 1;
strncpy(mywd.wd_hostname, myname, mynamelen);
- mywd.wd_hostname[sizeof(mywd.wd_hostname)-1] = 0;
+ mywd.wd_hostname[mynamelen] = 0;
getboottime(&mywd);
|