blob: 451a05866b0432170d29e8e881ea1d010d4aa0d2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From 7433bf4b18278080fb2ac22c5828490883066570 Mon Sep 17 00:00:00 2001
From: Nathan Scott <nathans@redhat.com>
Date: Mon, 15 Feb 2021 19:32:55 +1100
Subject: [PATCH] Correctly detect failure to initialize boottime
A zero value for btime (boottime) in /proc/stat is a
real situation that happens, so deal with this case.
Resolves https://github.com/htop-dev/htop/issues/527
---
linux/LinuxProcessList.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -64,7 +64,7 @@
# define O_PATH 010000000
#endif
-static long long btime;
+static long long btime = -1;
static long jiffy;
@@ -240,7 +240,7 @@
}
fclose(statfile);
- if (!btime)
+ if (btime == -1)
CRT_fatalError("No btime in " PROCSTATFILE);
}
|