From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Larry D'Anna <larry@elder-gods.org>
Subject: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul")
Date: Thu, 25 Feb 2010 09:49:34 +0100 [thread overview]
Message-ID: <4B86399E.3090508@viscovery.net> (raw)
From: Johannes Sixt <j6t@kdbg.org>
An instance of fopen("/dev/null",...) was added to the code base. On
Windows, we have to use "nul" instead. This implements a compatibility
wrapper of fopen() that checks for this particular condition.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
compat/mingw.c | 8 ++++++++
compat/mingw.h | 3 +++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 5edf152..57aec93 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -140,6 +140,14 @@ int mingw_open (const char *filename, int oflags, ...)
return fd;
}
+#undef fopen
+FILE *mingw_fopen (const char *filename, const char *otype)
+{
+ if (!strcmp(filename, "/dev/null"))
+ filename = "nul";
+ return fopen(filename, otype);
+}
+
/*
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
diff --git a/compat/mingw.h b/compat/mingw.h
index f53bcca..e187b04 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -170,6 +170,9 @@ int link(const char *oldpath, const char *newpath);
int mingw_open (const char *filename, int oflags, ...);
#define open mingw_open
+FILE *mingw_fopen (const char *filename, const char *otype);
+#define fopen mingw_fopen
+
char *mingw_getcwd(char *pointer, int len);
#define getcwd mingw_getcwd
--
1.7.0.1285.g1a907.dirty
next reply other threads:[~2010-02-25 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 8:49 Johannes Sixt [this message]
2010-02-25 16:20 ` [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Larry D'Anna
2010-02-25 17:03 ` Junio C Hamano
2010-02-25 20:03 ` [PATCH maint] Windows: redirect f[re]open("/dev/null") to f[re]open("nul") Johannes Sixt
2010-02-25 20:16 ` [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Junio C Hamano
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=4B86399E.3090508@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=larry@elder-gods.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.