From 9a230771c0a0b27e2f26bbbc29a93ad1ad591ce9 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 31 Aug 2011 12:16:36 -0700 Subject: [PATCH] ensure uptime is initialized if /proc/uptime cannot be opened --- misc/ifstat.c | 2 +- misc/nstat.c | 2 +- misc/rtacct.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/ifstat.c b/misc/ifstat.c index 1cd55c4..7d33f5e 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -708,7 +708,7 @@ int main(int argc, char *argv[]) } if (!ignore_history) { FILE *tfp; - long uptime; + long uptime = -1; if ((tfp = fopen("/proc/uptime", "r")) != NULL) { if (fscanf(tfp, "%ld", &uptime) != 1) uptime = -1; diff --git a/misc/nstat.c b/misc/nstat.c index 4f73c62..2f06ffd 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -560,7 +560,7 @@ int main(int argc, char *argv[]) } if (!ignore_history) { FILE *tfp; - long uptime; + long uptime = -1; if ((tfp = fopen("/proc/uptime", "r")) != NULL) { if (fscanf(tfp, "%ld", &uptime) != 1) uptime = -1; diff --git a/misc/rtacct.c b/misc/rtacct.c index ab8fdbb..49168bd 100644 --- a/misc/rtacct.c +++ b/misc/rtacct.c @@ -580,7 +580,7 @@ int main(int argc, char *argv[]) if (!ignore_history) { FILE *tfp; - long uptime; + long uptime = -1; if ((tfp = fopen("/proc/uptime", "r")) != NULL) { if (fscanf(tfp, "%ld", &uptime) != 1) uptime = -1; -- 2.39.2