summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2016-05-14 19:45:37 +0000
committerkettenis <kettenis@openbsd.org>2016-05-14 19:45:37 +0000
commit7d6e883657a18ccbd53ef1d9783be6853478b4df (patch)
tree81837146cd64efc23043ce8170d9c3b8f7041fdc
parentTell the kernel where its symbols are. (diff)
downloadwireguard-openbsd-7d6e883657a18ccbd53ef1d9783be6853478b4df.tar.xz
wireguard-openbsd-7d6e883657a18ccbd53ef1d9783be6853478b4df.zip
Make getsecs() return 0 if EFI doesn't tell us the time.
-rw-r--r--sys/arch/armv7/stand/efiboot/efiboot.c7
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;