[Cluster-devel] [PATCH 03/19] ccs_tool: improve error checking on ccs_connect
Fabio M. Di Nitto
fdinitto at redhat.com
Tue Oct 25 12:08:54 UTC 2011
Spotted by Coverity Scan
Signed-off-by: Fabio M. Di Nitto <fdinitto at 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\n");
+ exit(EXIT_FAILURE);
+ }
if((error = ccs_disconnect(desc))){
fprintf(stderr, "ccs_disconnect failed: %s\n", 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\n");
+ exit(EXIT_FAILURE);
+ }
/* Process all the queries on the command-line */
for (i=1; i<argc; i++) {
--
1.7.4.4
More information about the Cluster-devel
mailing list