From 0ec872ee34db6da61a37cde73fcf61166386df88 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Wed, 1 Dec 2021 09:02:23 -0500 Subject: [PATCH] [irods/irods#6022] ilsresc reports an error on an unknown zone name. --- src/ilsresc.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/ilsresc.cpp b/src/ilsresc.cpp index 95051a44..56ea5901 100644 --- a/src/ilsresc.cpp +++ b/src/ilsresc.cpp @@ -180,6 +180,15 @@ showResc( char *name, int longOption, const char* zoneArgument, rcComm_t *Conn ) return 0; } + + if (status < 0) { + printError(Conn, status, "rcGenQuery"); + return status; + } + } + else if (status < 0) { + printError(Conn, status, "rcGenQuery"); + return status; } printCount += printGenQueryResults(Conn, status, genQueryOut, columnNames, longOption); @@ -192,6 +201,7 @@ showResc( char *name, int longOption, const char* zoneArgument, rcComm_t *Conn ) printf("----\n"); } + // Handles the error case. printCount += printGenQueryResults(Conn, status, genQueryOut, columnNames, longOption); } @@ -403,6 +413,12 @@ int showRescTree( const char *name, const char *zoneArgument, rcComm_t *Conn , D genQueryInp.continueInx = genQueryOut->continueInx; offset += genQueryOut->rowCnt; status = rcGenQuery( Conn, &genQueryInp, &genQueryOut ); + + if (status < 0) { + printError(Conn, status, "rcGenQuery"); + return status; + } + status = parseGenQueryOut( offset, genQueryOut, resc_names, resc_indices, resc_types, resc_parents, resc_map, roots ); } @@ -512,12 +528,11 @@ main( int argc, char **argv ) { printErrorStack( Conn->rError ); rcDisconnect( Conn ); - /* Exit 0 if one or more items were displayed */ - if ( status >= 0 ) { - return 0; + if (status < 0) { + return 1; } - return status; + return 0; } /*