]> mj.ucw.cz Git - nwho.git/blobdiff - nwhod.c
Fixed calculation of idle time (only atime should be used)
[nwho.git] / nwhod.c
diff --git a/nwhod.c b/nwhod.c
index 05e73a91a23eece788753f5cd1d5696bfbcb2bef..5d0cee02fae186192658bf61d73da082bef5f040 100644 (file)
--- a/nwhod.c
+++ b/nwhod.c
@@ -65,19 +65,19 @@ net_init(char *name)
 
   sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
   if (sock < 0)
-    die("socket: %m");
+    die("Cannot create socket: %m");
 
   sa.sin_family = AF_INET;
   sa.sin_port = port = htons(NWHO_PORT);
   sa.sin_addr.s_addr = INADDR_ANY;
   if (bind(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0)
-    die("bind: %m");
+    die("Cannot bind to UDP port %d: %m", NWHO_PORT);
 
   if (h)
     {
       memcpy(&sa.sin_addr.s_addr, h->h_addr, sizeof(sa.sin_addr.s_addr));
       if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0)
-       die("connect: %m");
+       die("Cannot connect socket: %m");
     }
 }
 
@@ -107,10 +107,6 @@ scan_utmp(struct nwho_pkt *p, time_t now)
          continue;
        h->mesg_y = !!(S_IWGRP & st.st_mode);
        last = st.st_atime;
-       if (st.st_mtime > last)
-         last = st.st_mtime;
-       if (st.st_ctime > last)
-         last = st.st_ctime;
        if (now < last)
          last = now;
        h->idle_time = htonl(now - last);