From 47379edbe44f328b968f4f2f98f50ba34903858a Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 14 May 2016 19:45:38 +0000 Subject: Make getsecs() return 0 if EFI doesn't tell us the time. --- sys/arch/armv7/stand/efiboot/efiboot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sys/arch/armv7') 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 @@ -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; -- cgit v1.2.3