]> git.sur5r.net Git - i3/i3status/commitdiff
Bugfix: Cast the integers to uint64_t *before* multiplying (Thanks msi)
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 15 Oct 2009 22:25:05 +0000 (00:25 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 15 Oct 2009 22:25:05 +0000 (00:25 +0200)
This fixes problems on 32-bit computers.

src/print_disk_info.c

index 7ad27a477c5d3f791c1fd1c5e272e5c01c30ac25..11111db0a7de2801c557c67e8098158df9ed3ad0 100644 (file)
@@ -51,17 +51,17 @@ void print_disk_info(const char *path, const char *format) {
                 }
 
                 if (BEGINS_WITH(walk+1, "free")) {
-                        print_bytes_human(buf.f_bsize * buf.f_bfree);
+                        print_bytes_human((uint64_t)buf.f_bsize * (uint64_t)buf.f_bfree);
                         walk += strlen("free");
                 }
 
                 if (BEGINS_WITH(walk+1, "used")) {
-                        print_bytes_human(buf.f_bsize * (buf.f_blocks - buf.f_bfree));
+                        print_bytes_human((uint64_t)buf.f_bsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree));
                         walk += strlen("used");
                 }
 
                 if (BEGINS_WITH(walk+1, "total")) {
-                        print_bytes_human(buf.f_bsize * buf.f_blocks);
+                        print_bytes_human((uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks);
                         walk += strlen("total");
                 }
         }