summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-06-14 03:55:54 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-06-14 03:55:54 +0000
commit62343209339f871a5677740425c472de4fff5507 (patch)
tree51c6ed0f92bfb3dfc543a6532fe09fa96f8ab721 /lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
parent4aeb47e23c826087e91501d3c0167624d4ce3ada (diff)
downloadbcm5719-llvm-62343209339f871a5677740425c472de4fff5507.tar.gz
bcm5719-llvm-62343209339f871a5677740425c472de4fff5507.zip
Fix mistakes relating to ProcessMonitor::DupDescriptor
llvm-svn: 132971
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
index 5bad483d91e..0a42c8cb7e7 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -722,7 +722,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
// FIXME: If two or more of the paths are the same we needlessly open
// the same file multiple times.
if (stdin_path != NULL && stdin_path[0])
- if (!DupDescriptor(stdin_path, STDIN_FILENO, O_RDONLY | O_CREAT))
+ if (!DupDescriptor(stdin_path, STDIN_FILENO, O_RDONLY))
exit(1);
if (stdout_path != NULL && stdout_path[0])
@@ -730,7 +730,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
exit(1);
if (stderr_path != NULL && stderr_path[0])
- if (!DupDescriptor(stderr_path, STDOUT_FILENO, O_WRONLY | O_CREAT))
+ if (!DupDescriptor(stderr_path, STDERR_FILENO, O_WRONLY | O_CREAT))
exit(1);
// Execute. We should never return.
@@ -1263,12 +1263,12 @@ ProcessMonitor::Detach()
bool
ProcessMonitor::DupDescriptor(const char *path, int fd, int flags)
{
- int target_fd = open(path, flags);
+ int target_fd = open(path, flags, 0666);
if (target_fd == -1)
return false;
- return (dup2(fd, target_fd) == -1) ? false : true;
+ return (dup2(target_fd, fd) == -1) ? false : true;
}
void
OpenPOWER on IntegriCloud