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 10-25-2011, 12:08 PM
"Fabio M. Di Nitto"
 
Default ccs_tool: improve error checking on ccs_connect

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 28bbadc... a0fee9f... M config/tools/ccs_tool/ccs_tool.c
config/tools/ccs_tool/ccs_tool.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/config/tools/ccs_tool/ccs_tool.c b/config/tools/ccs_tool/ccs_tool.c
index 28bbadc..a0fee9f 100644
--- a/config/tools/ccs_tool/ccs_tool.c
+++ b/config/tools/ccs_tool/ccs_tool.c
@@ -90,6 +90,10 @@ static int test_main(int argc, char *argv[], int old_format){
exit(EXIT_FAILURE);
}
desc = ccs_connect();
+ if (desc < 0) {
+ fprintf(stderr, "ccs_disconnect failed: unable to communicate with ccs
");
+ exit(EXIT_FAILURE);
+ }
if((error = ccs_disconnect(desc))){
fprintf(stderr, "ccs_disconnect failed: %s
", errstring(-error));
exit(EXIT_FAILURE);
@@ -173,6 +177,10 @@ static int xpath_query(int argc, char **argv)
}

handle = ccs_connect();
+ if (handle < 0) {
+ fprintf(stderr, "Unable to connect to ccs
");
+ exit(EXIT_FAILURE);
+ }

/* Process all the queries on the command-line */
for (i=1; i<argc; i++) {
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 03:55 AM.

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