While upgrading my alix based router from a September snapshot to the one
from January 17 I discovered that net/darkstat segfaults (but only on i386, 
not on amd64). With the patch below it builds and runs fine on i386 and
amd64. 

Is my patch the right approach to fix this issue?

Remi


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/darkstat/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- Makefile    15 Oct 2013 06:51:59 -0000      1.22
+++ Makefile    20 Jan 2014 20:54:25 -0000
@@ -3,7 +3,7 @@
 COMMENT=               network statistics gatherer with graphs
 
 DISTNAME=              darkstat-3.0.717
-REVISION=              1
+REVISION=              2
 CATEGORIES=            net www
 
 HOMEPAGE=              http://unix4lyfe.org/darkstat/
Index: patches/patch-graph_db_c
===================================================================
RCS file: patches/patch-graph_db_c
diff -N patches/patch-graph_db_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-graph_db_c    20 Jan 2014 20:54:25 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+--- graph_db.c.orig    Mon Jan 20 16:27:36 2014
++++ graph_db.c Mon Jan 20 16:15:04 2014
+@@ -47,7 +48,7 @@ static struct graph *graph_db[] = {
+ };
+ 
+ static unsigned int graph_db_size = sizeof(graph_db)/sizeof(*graph_db);
+-static long start_mono, start_real, last_real;
++static time_t start_mono, start_real, last_real;
+ 
+ void graph_init(void) {
+    unsigned int i;
+@@ -169,7 +170,7 @@ static void graph_resync(const time_t new_real) {
+ }
+ 
+ void graph_rotate(void) {
+-   long t, td;
++   time_t t, td;
+    struct tm *tm;
+    unsigned int i;
+ 
+@@ -287,7 +288,7 @@ struct str *html_front_page(void) {
+    struct str *buf, *rf;
+    unsigned int i;
+    char start_when[100];
+-   long d_real, d_mono;
++   time_t d_real, d_mono;
+ 
+    buf = str_make();
+    html_open(buf, "Graphs", /*path_depth=*/0, /*want_graph_js=*/1);
Index: patches/patch-now_c
===================================================================
RCS file: patches/patch-now_c
diff -N patches/patch-now_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-now_c 20 Jan 2014 20:54:25 -0000
@@ -0,0 +1,33 @@
+$OpenBSD$
+--- now.c.orig Mon Jan 20 16:26:45 2014
++++ now.c      Mon Jan 20 16:17:03 2014
+@@ -62,12 +62,12 @@ int clock_gettime(clockid_t clk_id, struct timespec *t
+ static struct timespec clock_real, clock_mono;
+ static int now_initialized = 0;
+ 
+-long now_real(void) {
++time_t now_real(void) {
+    assert(now_initialized);
+    return clock_real.tv_sec;
+ }
+ 
+-long now_mono(void) {
++time_t now_mono(void) {
+    assert(now_initialized);
+    return clock_mono.tv_sec;
+ }
+@@ -113,12 +113,12 @@ void now_update(void) {
+    all_clocks_update();
+ }
+ 
+-long mono_to_real(const long t) {
++time_t mono_to_real(const time_t t) {
+    assert(now_initialized);
+    return t - clock_mono.tv_sec + clock_real.tv_sec;
+ }
+ 
+-long real_to_mono(const long t) {
++time_t real_to_mono(const time_t t) {
+    assert(now_initialized);
+    return t - clock_real.tv_sec + clock_mono.tv_sec;
+ }
Index: patches/patch-now_h
===================================================================
RCS file: patches/patch-now_h
diff -N patches/patch-now_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-now_h 20 Jan 2014 20:54:25 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+--- now.h.orig Mon Jan 20 16:26:57 2014
++++ now.h      Mon Jan 20 16:18:05 2014
+@@ -20,11 +20,11 @@
+ void now_init(void);
+ void now_update(void); /* once per event loop (in darkstat.c) */
+ 
+-long now_real(void);
+-long now_mono(void);
++time_t now_real(void);
++time_t now_mono(void);
+ 
+-long mono_to_real(const long t);
+-long real_to_mono(const long t);
++time_t mono_to_real(const time_t t);
++time_t real_to_mono(const time_t t);
+ 
+ /* Emits warnings if a call is too slow. */
+ struct timespec;

Reply via email to