aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/io.c b/io.c
index dfe449cd..a4ed1e77 100644
--- a/io.c
+++ b/io.c
@@ -732,6 +732,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
fd = devopen(str, binmode("r"));
if (fd == INVALID_HANDLE && errno == EISDIR) {
*errflg = EISDIR;
+ /* do not free rp, saving it for reuse (save_rp = rp) */
return NULL;
}
rp->iop = iop_alloc(fd, str, NULL, TRUE);
@@ -742,7 +743,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
#ifdef HAVE_SOCKETS
if (inetfile(str, NULL, NULL)) {
*errflg = errno;
- free_rp(rp);
+ /* do not free rp, saving it for reuse (save_rp = rp) */
return NULL;
} else
#endif
@@ -833,8 +834,10 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
else
fatal(_("can't redirect to `%s' (%s)"),
str, strerror(errno));
- } else
+ } else {
+ /* do not free rp, saving it for reuse (save_rp = rp) */
return NULL;
+ }
}
}
}