From 3fe0ba9afc7504ec01a778d8d72bd0b72fd013e1 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sun, 10 Aug 2014 14:10:34 -0700 Subject: libnative: process spawning should not close inherited file descriptors * The caller should be responsible for cleaning up file descriptors * If a caller safely creates a file descriptor (via native::io::file::open) the returned structure (FileDesc) will try to clean up the file, failing in the process and writing error messages to the screen. * This should not happen as the caller has no public interface for telling the FileDesc structure to NOT free the underlying fd. * Alternatively, if another file is opened under the same fd held by the FileDesc structure returned by native::io::file::open, it will close the wrong file upon destruction. --- src/libnative/io/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libnative') diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 77822bbbc20..4b832a4a97e 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -80,7 +80,7 @@ impl Process { rtio::Ignored => { ret.push(None); Ok(None) } rtio::InheritFd(fd) => { ret.push(None); - Ok(Some(file::FileDesc::new(fd, true))) + Ok(Some(file::FileDesc::new(fd, false))) } rtio::CreatePipe(readable, _writable) => { let (reader, writer) = try!(pipe()); -- cgit 1.4.1-3-g733a5