FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 11-23-2011, 09:15 AM
"Fabio M. Di Nitto"
 
Default 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!
");
+ ret = -1;
+ goto out;
+ }
close(0);
close(1);
close(2);
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 03:17 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org