dup2 cannot take negative values.
From: Erik Hovland <erik@hovland.org>
---
mythtv/libs/libmythui/mythsystem.cpp | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/mythtv/libs/libmythui/mythsystem.cpp b/mythtv/libs/libmythui/mythsystem.cpp
index 107ce4f..5e30dec 100644
a
|
b
|
uint myth_system(const QString &command, int flags) |
91 | 91 | /* Attach stdin to /dev/null */ |
92 | 92 | close(0); |
93 | 93 | int fd = open("/dev/null", O_RDONLY); |
94 | | dup2(fd, 0); |
95 | | if (fd != 0) |
| 94 | if (fd > 0) |
| 95 | { |
| 96 | dup2(fd, 0); |
96 | 97 | close(fd); |
| 98 | } |
| 99 | else |
| 100 | { |
| 101 | VERBOSE(VB_IMPORTANT, (LOC_ERR + "open() failed because %1") |
| 102 | .arg(strerror(errno))); |
| 103 | } |
97 | 104 | |
98 | 105 | /* Run command */ |
99 | 106 | execl("/bin/sh", "sh", "-c", command.toUtf8().constData(), NULL); |