aboutsummaryrefslogtreecommitdiff
path: root/qlop.c
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-11-13 13:58:27 +0100
committerFabian Groffen <grobian@gentoo.org>2019-11-13 13:58:27 +0100
commit7698b3a4e1bdd309a77f075e430e9ef2b00d2daa (patch)
tree2d4895aa7a67160a2c9a8e1d073b683f68f4153e /qlop.c
parentqlop: check return from localtime in fmt_date (diff)
downloadportage-utils-7698b3a4e1bdd309a77f075e430e9ef2b00d2daa.tar.gz
portage-utils-7698b3a4e1bdd309a77f075e430e9ef2b00d2daa.tar.bz2
portage-utils-7698b3a4e1bdd309a77f075e430e9ef2b00d2daa.zip
qlop: avoid reporting bogus dates in fmt_elapsedtime
when the calculated seconds are negative, we probably had a corrupt log, so just garbage in/garbage out without trying to interpret it or something Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qlop.c')
-rw-r--r--qlop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qlop.c b/qlop.c
index 95cd64b..dcf1d47 100644
--- a/qlop.c
+++ b/qlop.c
@@ -225,7 +225,7 @@ static char *fmt_elapsedtime(struct qlop_mode *flags, time_t e)
time_t ss;
size_t bufpos = 0;
- if (flags->do_machine) {
+ if (flags->do_machine || e < 0) {
snprintf(_elapsed_buf, sizeof(_elapsed_buf),
"%s%zd%s",
GREEN, (size_t)e, NORM);