rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid division by zero.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 21:10:55 +01:00
parent b666e01b9c
commit 4e0a25a4c0
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/generic/rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid
division by zero.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.

View file

@ -34,5 +34,5 @@ grub_rtc_get_time_ms (void)
1 s 1 T rtc ticks
*/
grub_uint64_t ticks_ms_per_sec = ((grub_uint64_t) 1000) * grub_get_rtc ();
return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND, 0);
return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND ? : 1000, 0);
}