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) {
|
if (!ignore_history) {
|
||||||
FILE *tfp;
|
FILE *tfp;
|
||||||
long uptime;
|
long uptime = -1;
|
||||||
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
||||||
if (fscanf(tfp, "%ld", &uptime) != 1)
|
if (fscanf(tfp, "%ld", &uptime) != 1)
|
||||||
uptime = -1;
|
uptime = -1;
|
||||||
|
|
|
||||||
|
|
@ -560,7 +560,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if (!ignore_history) {
|
if (!ignore_history) {
|
||||||
FILE *tfp;
|
FILE *tfp;
|
||||||
long uptime;
|
long uptime = -1;
|
||||||
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
||||||
if (fscanf(tfp, "%ld", &uptime) != 1)
|
if (fscanf(tfp, "%ld", &uptime) != 1)
|
||||||
uptime = -1;
|
uptime = -1;
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (!ignore_history) {
|
if (!ignore_history) {
|
||||||
FILE *tfp;
|
FILE *tfp;
|
||||||
long uptime;
|
long uptime = -1;
|
||||||
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
if ((tfp = fopen("/proc/uptime", "r")) != NULL) {
|
||||||
if (fscanf(tfp, "%ld", &uptime) != 1)
|
if (fscanf(tfp, "%ld", &uptime) != 1)
|
||||||
uptime = -1;
|
uptime = -1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue