diff options
| author | yangwei <[email protected]> | 2019-08-06 18:50:16 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2019-08-06 18:50:16 +0800 |
| commit | 1d9a35f53308b3a05d728ab2393bbf6325ac91e1 (patch) | |
| tree | 14261f0a0f59c303e7f1f53aeae96a4359a79ee8 | |
| parent | bfc450bfe656bd7e2a70fffcbce4182a784cca99 (diff) | |
修复 #2 提及的时间结果错误问题,在SIGINT信号处理函数中增加结束时间计算
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | src/common/abort.c | 3 |
2 files changed, 4 insertions, 0 deletions
@@ -1 +1,2 @@ tcpburst +.vscode diff --git a/src/common/abort.c b/src/common/abort.c index 37d730f..9f44133 100644 --- a/src/common/abort.c +++ b/src/common/abort.c @@ -34,6 +34,7 @@ #include "defines.h" #include "common.h" +#include <errno.h> #include <signal.h> #include <stdlib.h> @@ -76,6 +77,8 @@ break_now(int signo) kill(tcpdump.pid, SIGKILL); #endif */ + if (gettimeofday(&end, NULL) < 0) + errx(-1, "gettimeofday() failed: %s", strerror(errno)); packet_stats(&begin, &end, bytes_sent, pkts_sent, failed); exit(1); } |
