mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oscar Forner Martinez <oscar.forner.martinez@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Oscar Forner Martinez <oscar.forner.martinez@gmail.com>
Subject: [PATCH] fs: isofs: Fix bug in the way to check if the year is a leap year
Date: Fri,  2 Jan 2015 16:08:48 +0000	[thread overview]
Message-ID: <1420214928-7104-1-git-send-email-oscar.forner.martinez@gmail.com> (raw)

The way to check if the year is a leap year was incomplete.
It was checking only if the year can be divided by 4, that is
necessary but not a sufficient condition. It has to check as well
if the year can not be divided by 100 or if the year can be
divided by 400.

Signed-off-by: Oscar Forner Martinez <oscar.forner.martinez@gmail.com>
---
 fs/isofs/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index 01e1ee7..d2dd602 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -38,7 +38,7 @@ int iso_date(char * p, int flag)
 			days += (year+1) / 4;
 		for (i = 1; i < month; i++)
 			days += monlen[i-1];
-		if (((year+2) % 4) == 0 && month > 2)
+		if (((year+2) % 4) == 0 && month > 2 && ((((year+2) % 100) != 0) || (((year+2) % 400) == 0)))
 			days++;
 		days += day - 1;
 		crtime = ((((days * 24) + hour) * 60 + minute) * 60)
-- 
2.2.1


             reply	other threads:[~2015-01-02 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 16:08 Oscar Forner Martinez [this message]
2015-01-02 17:10 ` Al Viro
     [not found]   ` <CADZ0XgJMzsgSBZEJdQ5FqEWVB+Y_ZHD0Vy5HFy-hbWVjwqy7KA@mail.gmail.com>
2015-01-02 22:03     ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420214928-7104-1-git-send-email-oscar.forner.martinez@gmail.com \
    --to=oscar.forner.martinez@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®