aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-10-09 21:14:52 +0200
committerArnold D. Robbins <arnold@skeeve.com>2011-10-09 21:14:52 +0200
commita75ad0f08b9ce337bc06a4be560488d3eacdea75 (patch)
tree7f648cf89fafab309855ecf40f592cae983df211 /io.c
parentedf4bdbef22dc370a9c9b262160d40ca8d6834a1 (diff)
downloadegawk-a75ad0f08b9ce337bc06a4be560488d3eacdea75.tar.gz
egawk-a75ad0f08b9ce337bc06a4be560488d3eacdea75.tar.bz2
egawk-a75ad0f08b9ce337bc06a4be560488d3eacdea75.zip
Fixes for io noticed on PC, and also pc versions.
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/io.c b/io.c
index df79499c..e423a436 100644
--- a/io.c
+++ b/io.c
@@ -444,9 +444,14 @@ remap_std_file(int oldfd)
int newfd;
int ret = -1;
- close(oldfd);
- newfd = open("/dev/null", O_RDWR);
- if (newfd >= 0 && newfd != oldfd) {
+ /*
+ * Give OS-specific routines in gawkmisc.c chance to interpret
+ * "/dev/null" as appropriate for their platforms.
+ */
+ newfd = os_devopen("/dev/null", O_RDWR);
+ if (newfd == INVALID_HANDLE)
+ newfd = open("/dev/null", O_RDWR);
+ if (newfd >= 0) {
/* dup2() will close oldfd for us first. */
ret = dup2(newfd, oldfd);
if (ret == 0)