Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 4e540d3b86ae3cb0893f409e5be32cab > files > 7

procps-3.2.8-8.fc13.src.rpm

diff -up procps-3.2.7/watch.c.p2 procps-3.2.7/watch.c
--- procps-3.2.7/watch.c.p2	2006-06-17 11:18:38.000000000 +0200
+++ procps-3.2.7/watch.c	2008-09-01 10:46:17.000000000 +0200
@@ -25,6 +25,9 @@
 #include <termios.h>
 #include <locale.h>
 #include "proc/procps.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 #ifdef FORCE_8BIT
 #undef isprint
@@ -138,6 +141,7 @@ int
 main(int argc, char *argv[])
 {
 	int optc;
+	int fd;
 	int option_differences = 0,
 	    option_differences_cumulative = 0,
 	    option_help = 0, option_version = 0;
@@ -260,7 +264,13 @@ main(int argc, char *argv[])
 			mvaddstr(0, width - tsl + 1, ts);
 			free(header);
 		}
-
+		close(0);
+		fd=open("/dev/null",O_RDWR);
+		if (fd!=0) {
+		  perror("open");
+		  do_exit(2);
+		}
+		
 		if (!(p = popen(command, "r"))) {
 			perror("popen");
 			do_exit(2);