Commit 9a230771 authored by Dan McGee's avatar Dan McGee Committed by Stephen Hemminger

ensure uptime is initialized if /proc/uptime cannot be opened

parent 1b129bf2
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment