check for the linux-specific proc filesystem...
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Fri, 19 Nov 2010 10:48:23 +0100
changeset 156 2898369b1cdc
parent 155 a54dcc86addb
child 157 e8fbd0653fda
check for the linux-specific proc filesystem... committer: Markus Bröker <mbroeker@largo.homelinux.org>
sts.c
--- a/sts.c
+++ b/sts.c
@@ -34,6 +34,10 @@
     time_t now = time (NULL);
 
     FILE *f = fopen ("/proc/uptime", "r");
+    if (f == NULL) {
+        perror ("FOPEN");
+        return EXIT_FAILURE;
+    }
     if (fgets (buf, sizeof (buf), f) == NULL) {
         perror ("FOPEN");
         exit (errno);