summaryrefslogtreecommitdiff
path: root/proc/sysinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'proc/sysinfo.c')
-rw-r--r--proc/sysinfo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/proc/sysinfo.c b/proc/sysinfo.c
index 1f9b1fb..15cdb83 100644
--- a/proc/sysinfo.c
+++ b/proc/sysinfo.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -105,6 +106,7 @@ int uptime(double *restrict uptime_secs, double *restrict idle_secs) {
unsigned long getbtime(void) {
static unsigned long btime = 0;
+ bool found_btime = false;
FILE *f;
if (btime)
@@ -119,12 +121,14 @@ unsigned long getbtime(void) {
}
while ((fgets(buf, sizeof buf, f))) {
- if (sscanf(buf, "btime %lu", &btime) == 1)
+ if (sscanf(buf, "btime %lu", &btime) == 1) {
+ found_btime = true;
break;
+ }
}
fclose(f);
- if (!btime) {
+ if (!found_btime) {
fputs("missing btime in " STAT_FILE "\n", stderr);
exit(1);
}