summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 20f8fb965..07302f462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 30 23:49:12 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): errno should be preserved for rb_sys_fail() when
+ fork failed.
+
Tue Nov 30 16:18:50 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (io_fread): need not to null terminate. [ruby-dev:24998]
diff --git a/io.c b/io.c
index 857a12a61..1eb9fdf68 100644
--- a/io.c
+++ b/io.c
@@ -2903,8 +2903,10 @@ pipe_open(argc, argv, mode)
if (modef & FMODE_READABLE) close(arg.pr[1]);
if (modef & FMODE_WRITABLE) close(arg.pw[0]);
if (pid == -1) {
+ int e = errno;
if (modef & FMODE_READABLE) close(arg.pr[0]);
if (modef & FMODE_WRITABLE) close(arg.pw[1]);
+ errno = e;
rb_sys_fail(cmd);
}
#define PIPE_FDOPEN(i) (rb_fdopen((i?arg.pw:arg.pr)[i], i?"w":"r"))