From 1d9a35f53308b3a05d728ab2393bbf6325ac91e1 Mon Sep 17 00:00:00 2001 From: yangwei Date: Tue, 6 Aug 2019 18:50:16 +0800 Subject: 修复 #2 提及的时间结果错误问题,在SIGINT信号处理函数中增加结束时间计算 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/common/abort.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index f3f921b..36ea009 100644 --- a/.gitignore +++ b/.gitignore @@ -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 #include #include @@ -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); } -- cgit v1.2.3