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/mythtv/libs/libmythui/mythsystem.cpp
+++ b/mythtv/libs/libmythui/mythsystem.cpp
@@ -91,9 +91,16 @@ uint myth_system(const QString &command, int flags)
         /* Attach stdin to /dev/null */
         close(0);
         int fd = open("/dev/null", O_RDONLY);
-        dup2(fd, 0);
-        if (fd != 0)
+        if (fd > 0)
+        {
+            dup2(fd, 0);
             close(fd);
+        }
+        else
+        {
+            VERBOSE(VB_IMPORTANT, (LOC_ERR + "open() failed because %1")
+                    .arg(strerror(errno)));
+        }
 
         /* Run command */
         execl("/bin/sh", "sh", "-c", command.toUtf8().constData(), NULL);
