diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 03:01:21 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 04:44:31 +1000 |
commit | 4287ed1ecbe21e7e90b9420b267edf8fe1482b71 (patch) | |
tree | 88e035804c977aa2a3fc02e859314fc114d83bdc | |
parent | be6cd4da128c27f6f58d600c3ab1d09422eff968 (diff) | |
download | busybox-w32-4287ed1ecbe21e7e90b9420b267edf8fe1482b71.tar.gz busybox-w32-4287ed1ecbe21e7e90b9420b267edf8fe1482b71.tar.bz2 busybox-w32-4287ed1ecbe21e7e90b9420b267edf8fe1482b71.zip |
mingw.c: make fopen support /dev/null (needed for cmp iirc)
-rw-r--r-- | include/mingw.h | 3 | ||||
-rw-r--r-- | libbb/mingw.c | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h index eae6a7d3a..763606e51 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -141,6 +141,9 @@ int link(const char *oldpath, const char *newpath); | |||
141 | int mingw_open (const char *filename, int oflags, ...); | 141 | int mingw_open (const char *filename, int oflags, ...); |
142 | #define open mingw_open | 142 | #define open mingw_open |
143 | 143 | ||
144 | FILE* mingw_fopen (const char *filename, const char *mode); | ||
145 | #define fopen mingw_fopen | ||
146 | |||
144 | int mingw_close (int fd); | 147 | int mingw_close (int fd); |
145 | #define close mingw_close | 148 | #define close mingw_close |
146 | 149 | ||
diff --git a/libbb/mingw.c b/libbb/mingw.c index eb239bbd6..62aad5d7e 100644 --- a/libbb/mingw.c +++ b/libbb/mingw.c | |||
@@ -150,6 +150,14 @@ int mingw_open (const char *filename, int oflags, ...) | |||
150 | return fd; | 150 | return fd; |
151 | } | 151 | } |
152 | 152 | ||
153 | #undef fopen | ||
154 | FILE *mingw_fopen (const char *filename, const char *mode) | ||
155 | { | ||
156 | if (!strcmp(filename, "/dev/null")) | ||
157 | filename = "nul"; | ||
158 | return fopen(filename, mode); | ||
159 | } | ||
160 | |||
153 | #undef close | 161 | #undef close |
154 | int mingw_close (int fd) | 162 | int mingw_close (int fd) |
155 | { | 163 | { |