- while (fgets(buffer, 1024, fh) != NULL) {
- /* look for the btime string and read the value */
- ret = sscanf(buffer, "btime %lu", &starttime);
- /* avoid further loops if btime has been found and read
- * correctly (hopefully) */
- if (ret == 1)
- break;
+ double uptime_seconds = 0.0;
+ if (fscanf(fh, "%lf", &uptime_seconds) != 1) {
+ ERROR("uptime plugin: No value read from " UPTIME_FILE "");
+ fclose(fh);
+ return -1;