From 371be36f887bbda7591e3af475e4ffcc683dbf48 Mon Sep 17 00:00:00 2001 From: henri Date: Thu, 2 May 2013 08:36:08 +0000 Subject: [PATCH] Declare variables before executing any statement to follow C standards. Report and original patch by Gisle Vanem. --- nsock/src/nsock_iod.c | 4 +++- nsock/src/nsock_pcap.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nsock/src/nsock_iod.c b/nsock/src/nsock_iod.c index 6c84bf696..79210ff2a 100644 --- a/nsock/src/nsock_iod.c +++ b/nsock/src/nsock_iod.c @@ -205,8 +205,10 @@ void nsi_delete(nsock_iod nsockiod, int pending_response) { for (i = 0; i < 3 && nsi->events_pending > 0; i++) { for (current = evlist_ar[i]; current != NULL; current = next) { + msevent *nse; + next = GH_LIST_ELEM_NEXT(current); - msevent *nse = (msevent *)GH_LIST_ELEM_DATA(current); + nse = (msevent *)GH_LIST_ELEM_DATA(current); /* we're done with this list of events for the current IOD */ if (nse->iod != nsi) diff --git a/nsock/src/nsock_pcap.c b/nsock/src/nsock_pcap.c index 84086d2a2..5ba9f0210 100644 --- a/nsock/src/nsock_pcap.c +++ b/nsock/src/nsock_pcap.c @@ -104,10 +104,7 @@ char* nsock_pcap_open(nsock_pool nsp, nsock_iod nsiod, const char *pcap_device, int failed, datalink; char *e; - gettimeofday(&nsock_tod, NULL); - #ifdef PCAP_CAN_DO_SELECT - #if PCAP_BSD_SELECT_HACK /* MacOsX reports error if to_ms is too big (like INT_MAX) with error * FAILED. Reported error: BIOCSRTIMEOUT: Invalid argument @@ -121,6 +118,8 @@ char* nsock_pcap_open(nsock_pool nsp, nsock_iod nsiod, const char *pcap_device, int to_ms = 1; #endif + gettimeofday(&nsock_tod, NULL); + if (mp) return "nsock-pcap: this nsi already has pcap device opened";