Skip to content

Commit

Permalink
Flush stdout buffer after displaying each responding host (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
royhills authored Jan 4, 2024
1 parent 4c2b297 commit b297d68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
arp-scan currently uses C89 but use of C99 features is planned for
the next release.

* arp-scan.c: flush stdout output buffer after displaying each response.
This ensures that responding hosts are seen immediately when reading
from a pipeline rather than having to wait until the output buffer
is filled.

2023-10-22 Roy Hills <royhills@hotmail.com>

* TODO: Moved all valid items from TODO to github issue with the
Expand Down
7 changes: 5 additions & 2 deletions arp-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,14 @@ display_packet(host_entry *he, arp_ether_ipv4 *arpei,
}
}
/*
* Display the message on stdout.
* Display the message on stdout and flush output buffer.
*/
printf("%s\n", msg);
fflush(stdout);
/*
* Free the message and any field values.
*/
free(msg);

for (i=0; i<NUMFIELDS; i++)
if (fields[i].value) {
free(fields[i].value);
Expand Down

0 comments on commit b297d68

Please sign in to comment.