aboutsummaryrefslogtreecommitdiff
path: root/libbb/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libbb/mingw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libbb/mingw.c b/libbb/mingw.c
index aa1417acf..ab582215b 100644
--- a/libbb/mingw.c
+++ b/libbb/mingw.c
@@ -2,6 +2,7 @@
2#include "win32.h" 2#include "win32.h"
3#include "strbuf.h" 3#include "strbuf.h"
4#include "run-command.h" 4#include "run-command.h"
5#include "git.h"
5 6
6unsigned int _CRT_fmode = _O_BINARY; 7unsigned int _CRT_fmode = _O_BINARY;
7 8
@@ -131,13 +132,15 @@ int mingw_open (const char *filename, int oflags, ...)
131{ 132{
132 va_list args; 133 va_list args;
133 unsigned mode; 134 unsigned mode;
135 int fd;
136
134 va_start(args, oflags); 137 va_start(args, oflags);
135 mode = va_arg(args, int); 138 mode = va_arg(args, int);
136 va_end(args); 139 va_end(args);
137 140
138 if (!strcmp(filename, "/dev/null")) 141 if (!strcmp(filename, "/dev/null"))
139 filename = "nul"; 142 filename = "nul";
140 int fd = open(filename, oflags, mode); 143 fd = open(filename, oflags, mode);
141 if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) { 144 if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
142 DWORD attrs = GetFileAttributes(filename); 145 DWORD attrs = GetFileAttributes(filename);
143 if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) 146 if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))