]> code.delx.au - monosys/commitdiff
xfce4-genmon-script: use long to parse zfs arc_used
authorJames Bunton <jbunton@atlassian.com>
Sat, 26 Aug 2017 08:11:42 +0000 (18:11 +1000)
committerJames Bunton <jbunton@atlassian.com>
Thu, 5 Oct 2017 11:14:52 +0000 (22:14 +1100)
xfce4-genmon-script.c

index 4a02e355bf79c507e874bf62d6be5ee3910e6e20..3be3f174a4c28b0c0457e9b2296f6bb93055e4b2 100644 (file)
@@ -49,13 +49,13 @@ char* read_file(char* filename) {
     }
 }
 
-int parse_int(char* s) {
+long parse_int(char* s) {
     if (s == NULL) {
         return -1;
     }
 
     errno = 0;
-    int value = strtol(s, NULL, 10);
+    long value = strtol(s, NULL, 10);
     if (errno != 0) {
         fprintf(stderr, "Failed to parse string: %s -- %s\n", strerror(errno), s);
         return -1;
@@ -186,7 +186,7 @@ int read_zfs_arc_used_mibis() {
         }
 
         if (strcmp(key, "size") == 0) {
-            int arc_used = parse_int(value_str);
+            long arc_used = parse_int(value_str);
             return (int)round((double)arc_used / 1024 / 1024);
         }
     }