[macruby-changes] [2897] MacRuby/trunk/io.c
source_changes at macosforge.org
source_changes at macosforge.org
Sat Oct 24 21:23:36 PDT 2009
Revision: 2897
http://trac.macosforge.org/projects/ruby/changeset/2897
Author: lsansonetti at apple.com
Date: 2009-10-24 21:23:32 -0700 (Sat, 24 Oct 2009)
Log Message:
-----------
fixing a bug in IO.popen
Modified Paths:
--------------
MacRuby/trunk/io.c
Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c 2009-10-25 03:22:59 UTC (rev 2896)
+++ MacRuby/trunk/io.c 2009-10-25 04:23:32 UTC (rev 2897)
@@ -2075,19 +2075,19 @@
io_struct->pid = pid;
io_struct->mode = mode;
- // Confusingly enough, FMODE_WRITABLE means 'write-only'
- // and FMODE_READABLE means 'read-only'.
const int fmode = convert_mode_string_to_fmode(mode);
- if (fmode != FMODE_WRITABLE) {
+ if (fmode & FMODE_READABLE) {
io_struct->read_fd = fd[0];
}
- if (fmode != FMODE_READABLE) {
+ else {
+ close(fd[0]);
+ }
+ if (fmode & FMODE_WRITABLE) {
io_struct->write_fd = fd[1];
}
else {
- close(fd[1]);
+ close(fd[1]);
}
-
return io;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091024/8c69952e/attachment-0001.html>
More information about the macruby-changes
mailing list