From: Dan McGee Date: Wed, 31 Aug 2011 19:16:36 +0000 (-0700) Subject: ensure uptime is initialized if /proc/uptime cannot be opened X-Git-Tag: v3.0.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a230771c0a0b27e2f26bbbc29a93ad1ad591ce9;p=thirdparty%2Fiproute2.git ensure uptime is initialized if /proc/uptime cannot be opened --- diff --git a/misc/ifstat.c b/misc/ifstat.c index 1cd55c480..7d33f5e36 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 4f73c628d..2f06ffdd6 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 ab8fdbb80..49168bdd6 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;