From 25520aab6144927a20d501c0396e9597f36fc871 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 24 Oct 2013 22:03:09 +0300 Subject: Improve handling of writes to dead pipes. --- io.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index e0632d8b..3daadb32 100644 --- a/io.c +++ b/io.c @@ -1261,12 +1261,15 @@ flush_io() int status = 0; errno = 0; + /* we don't warn about stdout/stderr if EPIPE, but we do error exit */ if (fflush(stdout)) { - warning(_("error writing standard output (%s)"), strerror(errno)); + if (errno != EPIPE) + warning(_("error writing standard output (%s)"), strerror(errno)); status++; } if (fflush(stderr)) { - warning(_("error writing standard error (%s)"), strerror(errno)); + if (errno != EPIPE) + warning(_("error writing standard error (%s)"), strerror(errno)); status++; } for (rp = red_head; rp != NULL; rp = rp->next) @@ -1316,13 +1319,16 @@ close_io(bool *stdio_problem) * them, we just flush them, and do that across the board. */ *stdio_problem = false; - if (fflush(stdout)) { - warning(_("error writing standard output (%s)"), strerror(errno)); + /* we don't warn about stdout/stderr if EPIPE, but we do error exit */ + if (fflush(stdout) != 0) { + if (errno != EPIPE) + warning(_("error writing standard output (%s)"), strerror(errno)); status++; *stdio_problem = true; } - if (fflush(stderr)) { - warning(_("error writing standard error (%s)"), strerror(errno)); + if (fflush(stderr) != 0) { + if (errno != EPIPE) + warning(_("error writing standard error (%s)"), strerror(errno)); status++; *stdio_problem = true; } -- cgit v1.2.3 From 7bc4e38b948e20f3d72e06662691a527a50eecbf Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 3 Dec 2013 22:13:49 +0200 Subject: VMS fixes in io.c. --- io.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 3daadb32..ce63ec7a 100644 --- a/io.c +++ b/io.c @@ -947,7 +947,10 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) /* Alpha/VMS V7.1's C RTL is returning this instead of EMFILE (haven't tried other post-V6.2 systems) */ #define SS$_EXQUOTA 0x001C - else if (errno == EIO && vaxc$errno == SS$_EXQUOTA) +#define SS$_EXBYTLM 0x2a14 /* VMS 8.4 seen */ + else if (errno == EIO && + (vaxc$errno == SS$_EXQUOTA || + vaxc$errno == SS$_EXBYTLM)) close_one(); #endif else { @@ -2632,7 +2635,10 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) return NULL; } erealloc(path, char *, strlen(path) + strlen(src) + 2, "do_find_source"); -#ifndef VMS +#ifdef VMS + if (strcspn(path,">]:") == strlen(path)) + strcat(path, "/"); +#else strcat(path, "/"); #endif strcat(path, src); -- cgit v1.2.3 From 4b44495a814afb5ed896ac21fe5aaeb4b3a1cd4a Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 10 Dec 2013 21:11:33 +0200 Subject: DJGPP fixes, including update pc/Makefile.tst. --- io.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index ce63ec7a..4f244532 100644 --- a/io.c +++ b/io.c @@ -116,6 +116,10 @@ #define ENFILE EMFILE #endif +#if defined(__DJGPP__) +#define closemaybesocket(fd) close(fd) +#endif + #if defined(VMS) #define closemaybesocket(fd) close(fd) #endif -- cgit v1.2.3 From 9953f4cee02f2781ee5da2e42bcb837c1a849cb0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Dec 2013 20:45:59 +0200 Subject: First round of VMS changes. --- io.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 4f244532..ac1855ba 100644 --- a/io.c +++ b/io.c @@ -121,6 +121,11 @@ #endif #if defined(VMS) +#include +#ifndef SS$_EXBYTLM +#define SS$_EXBYTLM 0x2a14 /* VMS 8.4 seen */ +#endif +#include #define closemaybesocket(fd) close(fd) #endif @@ -462,6 +467,11 @@ nextfile(IOBUF **curfile, bool skipping) /* IOBUF management: */ errno = 0; fd = devopen(fname, binmode("r")); + if (fd == INVALID_HANDLE && errno == EMFILE) { + close_one(); + close_one(); + fd = devopen(fname, binmode("r")); + } errcode = errno; if (! do_traditional) update_ERRNO_int(errno); @@ -948,13 +958,13 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) if (errno == EMFILE || errno == ENFILE) close_one(); #ifdef VMS - /* Alpha/VMS V7.1's C RTL is returning this instead + /* Alpha/VMS V7.1+ C RTL is returning these instead of EMFILE (haven't tried other post-V6.2 systems) */ -#define SS$_EXQUOTA 0x001C -#define SS$_EXBYTLM 0x2a14 /* VMS 8.4 seen */ - else if (errno == EIO && + else if ((errno == EIO || errno == EVMSERR) && (vaxc$errno == SS$_EXQUOTA || - vaxc$errno == SS$_EXBYTLM)) + vaxc$errno == SS$_EXBYTLM || + vaxc$errno == RMS$_ACC || + vaxc$errno == RMS$_SYN)) close_one(); #endif else { -- cgit v1.2.3 From 664868f72b741ba448398d609e18a4cbb1ca20be Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 10 Jan 2014 12:28:09 +0200 Subject: Update some copyright years. --- io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index ac1855ba..3e527da0 100644 --- a/io.c +++ b/io.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. -- cgit v1.2.3