From: Johannes Sixt <j.sixt@viscovery.net>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH 1/2 fixed] mingw_utime(): handle NULL times parameter
Date: Thu, 01 Jul 2010 14:16:24 +0200 [thread overview]
Message-ID: <4C2C8718.5080203@viscovery.net> (raw)
In-Reply-To: <1277982466-29601-1-git-send-email-szeder@ira.uka.de>
From: SZEDER Gábor <szeder@ira.uka.de>
POSIX sayeth:
"If times is a null pointer, the access and modification
times of the file shall be set to the current time."
Let's do so.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
>> Mental note: update mingw_utime to accept NULL for the second
>> parameter...
>
> Here it is, but I don't have mingw, so it's completely untested.
Thanks. Here is a version that compiles; the interdiff is
@@ -309,8 +309,7 @@
time_t_to_filetime(times->actime, &aft);
} else {
GetSystemTimeAsFileTime(&mft);
- aft->dwLowDateTime = mft->dwLowDateTime;
- aft->dwHighDateTime = mft->dwHighDateTime;
+ aft = mft;
}
if (!SetFileTime((HANDLE)_get_osfhandle(fh), NULL, &aft, &mft)) {
errno = EINVAL;
With this, the series passes the test suite on MinGW.
-- Hannes
compat/mingw.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 0722a6d..b6f0a7f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -304,8 +304,13 @@ int mingw_utime (const char *file_name, const struct utimbuf *times)
goto revert_attrs;
}
- time_t_to_filetime(times->modtime, &mft);
- time_t_to_filetime(times->actime, &aft);
+ if (times) {
+ time_t_to_filetime(times->modtime, &mft);
+ time_t_to_filetime(times->actime, &aft);
+ } else {
+ GetSystemTimeAsFileTime(&mft);
+ aft = mft;
+ }
if (!SetFileTime((HANDLE)_get_osfhandle(fh), NULL, &aft, &mft)) {
errno = EINVAL;
rc = -1;
--
1.7.2.rc1.1057.g1270
next prev parent reply other threads:[~2010-07-01 12:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 11:38 [RFC PATCH] rerere: fix overeager gc SZEDER Gábor
2010-06-29 17:59 ` Junio C Hamano
2010-06-30 6:12 ` Johannes Sixt
2010-06-30 8:01 ` SZEDER Gábor
2010-06-30 15:22 ` Junio C Hamano
2010-06-30 15:40 ` Johannes Sixt
2010-07-01 9:36 ` [PATCH v2] " SZEDER Gábor
2010-07-01 10:10 ` Johannes Sixt
2010-07-01 11:07 ` [PATCH 1/2] mingw: utime() handles NULL times parameter SZEDER Gábor
2010-07-01 12:16 ` Johannes Sixt [this message]
2010-07-01 11:07 ` [PATCH 2/2] rerere: fix overeager gc SZEDER Gábor
2010-07-01 16:27 ` [RFC PATCH] " Junio C Hamano
2010-07-02 5:49 ` Johannes Sixt
2010-07-02 17:25 ` Junio C Hamano
2010-07-05 6:02 ` Johannes Sixt
2010-07-08 14:35 ` [PATCH v4] " SZEDER Gábor
2010-07-09 0:06 ` [RFC PATCH] " Junio C Hamano
2010-07-12 23:42 ` [PATCH 1/2] mingw_utime(): handle NULL times parameter SZEDER Gábor
2010-07-12 23:42 ` [PATCH 2/2] rerere: fix overeager gc SZEDER Gábor
2010-07-13 0:40 ` Junio C Hamano
2010-07-14 12:19 ` SZEDER Gábor
2010-07-14 16:23 ` Junio C Hamano
2010-07-14 18:33 ` SZEDER Gábor
2010-07-08 6:27 ` [RFC PATCH] " Johannes Sixt
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=4C2C8718.5080203@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
/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;
as well as URLs for NNTP newsgroup(s).