summaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorOscar Forner Martinez <oscar.forner.martinez@gmail.com>2015-01-07 01:54:19 +0100
committerJan Kara <jack@suse.cz>2015-01-07 09:51:49 +0100
commite4a93be6cb281fb3dbbd41b22aee02cb0e551ba8 (patch)
treeb0428e113fdd21fb24504807a6de83c6971bdc25 /fs/isofs
parentext3: destroy sbi mutexes in put_super (diff)
downloadlinux-e4a93be6cb281fb3dbbd41b22aee02cb0e551ba8.tar.xz
linux-e4a93be6cb281fb3dbbd41b22aee02cb0e551ba8.zip
isofs: Fix bug in the way to check if the year is a leap year
Changed the whole algorithm for a call to mktime64 that takes care of all that details. Signed-off-by: Oscar Forner Martinez <oscar.forner.martinez@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/util.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index 01e1ee7a998b..005a15cfd30a 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -2,6 +2,7 @@
* linux/fs/isofs/util.c
*/
+#include <linux/time.h>
#include "isofs.h"
/*
@@ -17,9 +18,9 @@
int iso_date(char * p, int flag)
{
int year, month, day, hour, minute, second, tz;
- int crtime, days, i;
+ int crtime;
- year = p[0] - 70;
+ year = p[0];
month = p[1];
day = p[2];
hour = p[3];
@@ -31,18 +32,7 @@ int iso_date(char * p, int flag)
if (year < 0) {
crtime = 0;
} else {
- int monlen[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
-
- days = year * 365;
- if (year > 2)
- days += (year+1) / 4;
- for (i = 1; i < month; i++)
- days += monlen[i-1];
- if (((year+2) % 4) == 0 && month > 2)
- days++;
- days += day - 1;
- crtime = ((((days * 24) + hour) * 60 + minute) * 60)
- + second;
+ crtime = mktime64(year+1900, month, day, hour, minute, second);
/* sign extend */
if (tz & 0x80)