Fix year correction in platform_add_date so that:
* Years in the [90,99] range are considered to be in 1900. * Years in the [0,89] range are considered to be in 2000. This makes my MacBookPro2,2 be recognized as from 2007 instead of 1907, which in turn lets ACPI (and many other things!) work. Fix proposed by jmcneill@ as an alternative to my workaround in acpi_quirks.c sent to port-i386@.
This commit is contained in:
parent
b3a50c46ea
commit
ea024283b0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $ */
|
||||
/* $NetBSD: platform.c,v 1.10 2011/01/17 22:21:25 jmmv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include "isa.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.10 2011/01/17 22:21:25 jmmv Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -165,10 +165,12 @@ platform_add_date(struct smbtable *tbl, const char *key, int idx)
|
|||
return;
|
||||
if (month == 0 || month > 12 || day == 0 || day > 31)
|
||||
return;
|
||||
if (year < 100)
|
||||
year += 1900;
|
||||
if (year > 9999)
|
||||
return;
|
||||
if (year < 90)
|
||||
year += 2000;
|
||||
else if (year < 100)
|
||||
year += 1900;
|
||||
sprintf(datestr, "%04u%02u%02u", year, month, day);
|
||||
pmf_set_platform(key, datestr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue