mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Avoid unnecessary assert failure: http://seclists.org/nmap-dev/2016/q3/98
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o Avoid an unnecessary assert failure in timing.cc when printing estimated
|
||||||
|
completion time. Instead, we'll output a diagnostic error message:
|
||||||
|
Timing error: localtime(n) is NULL
|
||||||
|
where "n" is some number that is causing problems. [Jean-Guilhem Nousse]
|
||||||
|
|
||||||
o [NSE] Removed the obsolete script ip-geolocation-geobytes. [Paulino Calderon]
|
o [NSE] Removed the obsolete script ip-geolocation-geobytes. [Paulino Calderon]
|
||||||
|
|
||||||
o Added --script-timeout option for limiting run time for every
|
o Added --script-timeout option for limiting run time for every
|
||||||
|
|||||||
21
timing.cc
21
timing.cc
@@ -707,13 +707,22 @@ bool ScanProgressMeter::printStats(double perc_done,
|
|||||||
/* Get the estimated time of day at completion */
|
/* Get the estimated time of day at completion */
|
||||||
timet = last_est.tv_sec;
|
timet = last_est.tv_sec;
|
||||||
ltime = localtime(&timet);
|
ltime = localtime(&timet);
|
||||||
assert(ltime);
|
|
||||||
|
|
||||||
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: %02d:%02d (%.f:%02.f:%02.f remaining)\n",
|
if (ltime) {
|
||||||
scantypestr, perc_done * 100, ltime->tm_hour, ltime->tm_min,
|
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: %02d:%02d (%.f:%02.f:%02.f remaining)\n",
|
||||||
floor(time_left_s / 60.0 / 60.0),
|
scantypestr, perc_done * 100, ltime->tm_hour, ltime->tm_min,
|
||||||
floor(fmod(time_left_s / 60.0, 60.0)),
|
floor(time_left_s / 60.0 / 60.0),
|
||||||
floor(fmod(time_left_s, 60.0)));
|
floor(fmod(time_left_s / 60.0, 60.0)),
|
||||||
|
floor(fmod(time_left_s, 60.0)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log_write(LOG_STDERR, "Timing error: localtime(%f) is NULL\n", (double) timet);
|
||||||
|
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: Unknown (%.f:%02.f:%02.f remaining)\n",
|
||||||
|
scantypestr, perc_done * 100,
|
||||||
|
floor(time_left_s / 60.0 / 60.0),
|
||||||
|
floor(fmod(time_left_s / 60.0, 60.0)),
|
||||||
|
floor(fmod(time_left_s, 60.0)));
|
||||||
|
}
|
||||||
xml_open_start_tag("taskprogress");
|
xml_open_start_tag("taskprogress");
|
||||||
xml_attribute("task", "%s", scantypestr);
|
xml_attribute("task", "%s", scantypestr);
|
||||||
xml_attribute("time", "%lu", (unsigned long) now->tv_sec);
|
xml_attribute("time", "%lu", (unsigned long) now->tv_sec);
|
||||||
|
|||||||
Reference in New Issue
Block a user