mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-01-01 06:26:52 +00:00
ensure uptime is initialized if /proc/uptime cannot be opened
This commit is contained in:
parent
1b129bf2fe
commit
9a230771c0
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user