summaryrefslogtreecommitdiff
path: root/net/nocol/patches/patch-al
blob: 9f95238ffb76dea4bbdff3604069ef5f64a46011 (plain)
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
41
42
$NetBSD: patch-al,v 1.2 2012/09/09 19:35:20 dholland Exp $

--- portmon/portmon.c.orig	2000-04-06 19:32:26.000000000 +0000
+++ portmon/portmon.c
@@ -81,4 +81,6 @@ static char rcsid[] = "$Id: portmon.c,v 
 #endif
 
+#include <stdlib.h>
+
 #include "portmon.h"
 
@@ -181,5 +183,5 @@ main(ac, av)
 	{
 	  update_event(&v, harray[i]->status,
-		       /* value */ (u_long)(harray[i]->status),
+		       /* value */ (u_long)(harray[i]->elapsedsecs),
 		       harray[i]->testseverity) ;
 	  lseek(fdout, -(off_t)sizeof(v), SEEK_CUR);
@@ -659,14 +661,19 @@ static char *Strcasestr(haystack, needle
     do
     {
-      if (tolower(*s1) != tolower(*s2++)  || *s1 == 0)	/* */
+      if (*s1 == 0 || tolower(*s1) != tolower(*s2++))	/* */
 	break;
       ++s1;
     } while (--n != 0);
 
-    if (n == 0 || *s1 == 0)
-      break;	/* found, break out of forever loop */
+    if (n == 0) {
+	--haystack;
+	break;		/* found, break out of forever loop */
+    }
+    if (*s1 == 0) {
+	haystack = NULL;
+	break;		/* not found, break out of forever loop */
+    }
 
   }	/* end for */
-  haystack--;
   return ((char *)haystack);
 }	/* Strcasestr() */