diff options
author | Ron Yorston <rmy@pobox.com> | 2018-03-15 09:11:14 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-03-15 09:11:14 +0000 |
commit | f011d7284d8cabe5d453b43d4df44d0423db22c8 (patch) | |
tree | a977947524838edd2915bd2861bda25b25f72376 | |
parent | 94cf1f830d25409ba80b0933075e026e41fe0e3c (diff) | |
download | busybox-w32-f011d7284d8cabe5d453b43d4df44d0423db22c8.tar.gz busybox-w32-f011d7284d8cabe5d453b43d4df44d0423db22c8.tar.bz2 busybox-w32-f011d7284d8cabe5d453b43d4df44d0423db22c8.zip |
ash: remove special treatment of device files
Since device files are now handled in mingw_open there's no need
for any special treatment in ash redirection.
-rw-r--r-- | shell/ash.c | 20 | ||||
-rw-r--r-- | win32/mingw.c | 4 |
2 files changed, 3 insertions, 21 deletions
diff --git a/shell/ash.c b/shell/ash.c index 394022df9..778d8bd9d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -5702,26 +5702,6 @@ openredirect(union node *redir) | |||
5702 | * allocated space. Do it only when we know it is safe. | 5702 | * allocated space. Do it only when we know it is safe. |
5703 | */ | 5703 | */ |
5704 | fname = redir->nfile.expfname; | 5704 | fname = redir->nfile.expfname; |
5705 | #if ENABLE_PLATFORM_MINGW32 | ||
5706 | /* Support for /dev/null */ | ||
5707 | switch (redir->nfile.type) { | ||
5708 | case NFROM: | ||
5709 | case NFROMTO: | ||
5710 | case NTO: | ||
5711 | #if BASH_REDIR_OUTPUT | ||
5712 | case NTO2: | ||
5713 | #endif | ||
5714 | case NCLOBBER: | ||
5715 | case NAPPEND: | ||
5716 | if (!strncmp(fname, "/dev/", 5)) { | ||
5717 | if (!strcmp(fname+5, "null")) | ||
5718 | return open(fname,O_RDWR); | ||
5719 | ash_msg_and_raise_error("Unhandled device %s\n", fname); | ||
5720 | return -1; | ||
5721 | } | ||
5722 | break; | ||
5723 | } | ||
5724 | #endif | ||
5725 | 5705 | ||
5726 | switch (redir->nfile.type) { | 5706 | switch (redir->nfile.type) { |
5727 | default: | 5707 | default: |
diff --git a/win32/mingw.c b/win32/mingw.c index 981c50415..7fe5a6f05 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -181,8 +181,10 @@ int mingw_open (const char *filename, int oflags, ...) | |||
181 | devrand = 1; | 181 | devrand = 1; |
182 | } | 182 | } |
183 | 183 | ||
184 | if (devnull || devzero || devrand ) | 184 | if (devnull || devzero || devrand ) { |
185 | filename = "nul"; | 185 | filename = "nul"; |
186 | oflags = O_RDWR; | ||
187 | } | ||
186 | } | 188 | } |
187 | fd = open(filename, oflags, mode); | 189 | fd = open(filename, oflags, mode); |
188 | if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) { | 190 | if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) { |