From 409e53b7b9943cc9db60839bb142eb102d1a6aee Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 26 Oct 2005 21:49:57 +0000 Subject: [PATCH] Compiles again on BSD --- src/probe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/probe.c b/src/probe.c index b3cb7b8..0a3ee15 100644 --- a/src/probe.c +++ b/src/probe.c @@ -130,16 +130,18 @@ struct ifinfo int stats[IF_LAST+1]; }; +#ifdef _GNU_SOURCE static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb); +#endif static int ifinfo(struct ifinfo ** dev) { int ret = 0; +#ifdef _GNU_SOURCE FILE * fp; char buf[200]; int i; int len; -#ifdef _GNU_SOURCE if((fp = fopen("/proc/net/dev", "r")) == NULL) return -1; for(i = 0; fgets(buf, sizeof(buf), fp) != NULL; i++) @@ -160,10 +162,11 @@ static int ifinfo(struct ifinfo ** dev) ret++; } fclose(fp); - return ret; #endif + return ret; } +#ifdef _GNU_SOURCE static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb) { struct ifinfo * p; @@ -195,6 +198,7 @@ static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb) } return 0; } +#endif /* Probe */ @@ -253,9 +257,9 @@ static int _probe_error(char * message, int ret) static int _probe_timeout(Probe * probe) { struct utmpx * ut; + int i; #ifdef DEBUG static unsigned int count = 0; - static int i; fprintf(stderr, "%s%d%s", "_probe_timeout(", count++, ")\n"); #endif