ensure uptime is initialized if /proc/uptime cannot be opened
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 @@
}
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 @@
}
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 @@
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;