* info.c (info_show_info): Cast myfs_stats.avail to double to

fix integer overflow that can cause a negative precent number.
This commit is contained in:
Pavel Roskin 2003-05-27 07:22:04 +00:00
parent 6d176d4cb6
commit 1866c37dbf
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2003-05-27 Andrew V. Samoilov <sav@bcs.zp.ua>
* info.c (info_show_info): Cast myfs_stats.avail to double to
fix integer overflow that can cause a negative precent number.
2003-05-05 Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
* main.c (directory_history_add): Don't change the directory

View File

@ -123,7 +123,8 @@ info_show_info (WInfo *info)
size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
size_trunc_len (buffer2, 5, myfs_stats.total, 1);
printw (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ?
100 * myfs_stats.avail / myfs_stats.total : 0, buffer2);
(int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0,
buffer2);
} else
addstr (_("No space information"));