diff --git a/apps/src/uptime.c b/apps/src/uptime.c index 4ee27daa..03e1ac01 100644 --- a/apps/src/uptime.c +++ b/apps/src/uptime.c @@ -10,17 +10,15 @@ int main() return 1; } - char buf[4096]; - size_t nread = fread(buf, sizeof(buf) - 1, 1, fp); + char buf[32]; + fgets(buf, sizeof(buf), fp); if (ferror(fp)) { - perror("fread"); + perror("fgets"); return 1; } - buf[nread] = 0; // null terminate it :) - long ms_uptime = atol(buf); printf("up for %ld seconds\n", ms_uptime / 1000);