Nmap Development mailing list archives

[PATCH] fflush(stdout) earlier in sigdie()


From: Kris Katterjohn <kjak () ispwest com>
Date: Wed, 15 Mar 2006 00:19:01 -0600

I was using -d2 and when I hit ^C, it said "caught SIGINT signal, cleaning up"
and then printed another "Discovered closed port ..." after it. The attached
patch flushes stdout earlier so that the signal message is the last thing printed.

Thanks,
Kris
--- nmap.cc.orig        2006-03-08 16:06:21.000000000 -0600
+++ nmap.cc     2006-03-15 00:10:31.000000000 -0600
@@ -2104,6 +2104,8 @@ void reaper(int signo) {
 void sigdie(int signo) {
   int abt = 0;
 
+  fflush(stdout);
+
   switch(signo) {
   case SIGINT:
     fprintf(stderr, "caught SIGINT signal, cleaning up\n");
@@ -2140,7 +2142,7 @@ void sigdie(int signo) {
     abt = 1;
     break;
   }
-  fflush(stdout);
+
   fflush(stderr);
   log_close(LOG_MACHINE|LOG_NORMAL|LOG_SKID);
   if (abt) abort();


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev

Current thread: