Skip to content

Commit

Permalink
iwcap: fix handling kill signal during dump
Browse files Browse the repository at this point in the history
Do not run another loop iteration before checking the stop flag

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Mar 14, 2017
1 parent 51130b9 commit 2f09a1e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions package/network/utils/iwcap/src/iwcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 2f09a1e

Please sign in to comment.