diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-03-09 08:53:52 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-03-14 13:29:03 +0100 |
commit | 2f09a1e3c950c9b2993ae52d1b0e78317c344470 (patch) | |
tree | 3c92ef1dc1536c7c7bd2446cffcff8950664d182 /package/network/utils/iwcap | |
parent | 51130b992734070b419ab047531b2978d67fb706 (diff) | |
download | upstream-2f09a1e3c950c9b2993ae52d1b0e78317c344470.tar.gz upstream-2f09a1e3c950c9b2993ae52d1b0e78317c344470.tar.bz2 upstream-2f09a1e3c950c9b2993ae52d1b0e78317c344470.zip |
iwcap: fix handling kill signal during dump
Do not run another loop iteration before checking the stop flag
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network/utils/iwcap')
-rw-r--r-- | package/network/utils/iwcap/src/iwcap.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/package/network/utils/iwcap/src/iwcap.c b/package/network/utils/iwcap/src/iwcap.c index 6bf25c57dd..bc69550ef3 100644 --- a/package/network/utils/iwcap/src/iwcap.c +++ b/package/network/utils/iwcap/src/iwcap.c @@ -490,19 +490,7 @@ int main(int argc, char **argv) /* capture loop */ while (1) { - if (run_stop) - { - msg("Shutting down ...\n"); - - if (promisc) - set_promisc(0); - - if (ring) - ringbuf_free(ring); - - return 0; - } - else if (run_dump) + if (run_dump) { msg("Dumping ring to %s ...\n", output); @@ -535,6 +523,18 @@ int main(int argc, char **argv) run_dump = 0; } + if (run_stop) + { + msg("Shutting down ...\n"); + + if (promisc) + set_promisc(0); + + if (ring) + ringbuf_free(ring); + + return 0; + } pktlen = recvfrom(capture_sock, pktbuf, sizeof(pktbuf), 0, NULL, 0); frames_captured++; |