Skip to content

Commit

Permalink
fix division-by-zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw committed Apr 25, 2015
1 parent b583214 commit ee0ccd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plat/linux/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void detect_disk(void)

disk_total /= GB;
disk_used /= GB;
disk_pct = (((double) disk_used / disk_total) * 100);
disk_pct = (disk_total > 0 ? (((double) disk_used / disk_total) * 100) : 0);

snprintf(disk_str, MAX_STRLEN, "%lluG / %lluG (%llu%%)", disk_used,
disk_total, disk_pct);
Expand Down

0 comments on commit ee0ccd6

Please sign in to comment.