[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 33/41] qdiskd: don't try the impossible if we can't open /dev/null



Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>
---
:100644 100644 3cbac37... c260cb8... M	cman/qdisk/daemon_init.c
:100644 100644 51d9a39... d21c209... M	cman/qdisk/main.c
 cman/qdisk/daemon_init.c |    2 +-
 cman/qdisk/main.c        |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
index 3cbac37..c260cb8 100644
--- a/cman/qdisk/daemon_init.c
+++ b/cman/qdisk/daemon_init.c
@@ -93,7 +93,7 @@ check_pid_valid(pid_t pid, char *prog)
 	/*
 	 * Check to see if this is the same executable.
 	 */
-	if ((s = strstr(proc_cmdline, prog)) == NULL) {
+	if (!strstr(proc_cmdline, prog)) {
 		return 0;
 	} else {
 		return 1;
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 51d9a39..d21c209 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1995,6 +1995,11 @@ main(int argc, char **argv)
 		case 'Q':
 			/* Make qdisk very quiet */
 			nfd = open("/dev/null", O_RDWR);
+			if (nfd < 0) {
+				fprintf(stderr, "Could not open /dev/null!\n");
+				ret = -1;
+				goto out;
+			}
 			close(0);
 			close(1);
 			close(2);
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]