diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-14 19:45:38 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-14 19:45:38 +0000 |
commit | 47379edbe44f328b968f4f2f98f50ba34903858a (patch) | |
tree | e7a4c89df2df8d35d029dae1806afd884e2cd57f /sys/arch/armv7 | |
parent | 029f28f3cebd9928367e7918cc08c0b094858896 (diff) |
Make getsecs() return 0 if EFI doesn't tell us the time.
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efiboot.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/armv7/stand/efiboot/efiboot.c b/sys/arch/armv7/stand/efiboot/efiboot.c index f3fe8a05362..aab2df33a56 100644 --- a/sys/arch/armv7/stand/efiboot/efiboot.c +++ b/sys/arch/armv7/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.1 2016/05/14 17:55:15 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.2 2016/05/14 19:45:37 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -258,6 +258,7 @@ time_t getsecs(void) { EFI_TIME t; + EFI_STATUS status; time_t r = 0; int y = 0; const int daytab[][14] = { @@ -266,7 +267,9 @@ getsecs(void) }; #define isleap(_y) (((_y) % 4) == 0 && (((_y) % 100) != 0 || ((_y) % 400) == 0)) - EFI_CALL(ST->RuntimeServices->GetTime, &t, NULL); + status = EFI_CALL(ST->RuntimeServices->GetTime, &t, NULL); + if (EFI_ERROR(status)) + return 0; /* Calc days from UNIX epoch */ r = (t.Year - 1970) * 365; |