examples: Fix scanf format in perf_writer_disk.
authorAndreas Schneider <asn@samba.org>
Fri, 15 Nov 2013 16:02:17 +0000 (17:02 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 15 Nov 2013 19:07:52 +0000 (11:07 -0800)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
examples/perfcounter/perf_writer_disk.c

index 15188d253141fa7cec8a201a777ad7c80915349f..18a63a4f476fd5d9306faa4a9d0f3c8e8e783498 100644 (file)
@@ -132,7 +132,7 @@ void get_diskinfo(PERF_DATA_BLOCK *data)
        int status, num;
        char buf[LARGE_BUF], *start;
        FILE *diskstats;
-       long reads, writes, discard;
+       unsigned long reads, writes, discard;
 
        diskstats = fopen("/proc/diskstats", "r");
        rewind(diskstats);
@@ -147,10 +147,10 @@ void get_diskinfo(PERF_DATA_BLOCK *data)
                p->freeMegs = (statfsbuf.f_bfree*statfsbuf.f_bsize)/1048576;
                start = strstr(buf, data->diskInfo.mdata[i].name);
                start += strlen(data->diskInfo.mdata[i].name) + 1;
-               num = sscanf(start, "%u %u %u %u",
+               num = sscanf(start, "%lu %lu %lu %lu",
                             &reads,
-                            &discard, 
-                            &writes, 
+                            &discard,
+                            &writes,
                             &discard);
                p->writesPerSec = writes;
                p->readsPerSec = reads;