- double uptime_seconds;
- int ret;
- FILE *fh;
-
- ret = 0;
-
- fh = fopen(UPTIME_FILE, "r");
-
- if (fh == NULL) {
- char errbuf[1024];
- ERROR("uptime plugin: Cannot open " UPTIME_FILE ": %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
- return -1;
- }
-
- ret = fscanf(fh, "%lf", &uptime_seconds);
-
- fclose(fh);
-
- /* loop done, check if no value has been found/read */
- if (ret != 1) {
- ERROR("uptime plugin: No value read from " UPTIME_FILE "");
- return -1;
- }