[Opensrf-commits] r1913 - trunk/src/srfsh (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Jan 31 23:32:50 EST 2010


Author: scottmk
Date: 2010-01-31 23:32:48 -0500 (Sun, 31 Jan 2010)
New Revision: 1913

Modified:
   trunk/src/srfsh/srfsh.c
Log:
Rearrange the error handling a bit in send_request().  The old code
looked like it would segfault in the case of a relay command.

M    src/srfsh/srfsh.c


Modified: trunk/src/srfsh/srfsh.c
===================================================================
--- trunk/src/srfsh/srfsh.c	2010-01-29 03:48:37 UTC (rev 1912)
+++ trunk/src/srfsh/srfsh.c	2010-02-01 04:32:48 UTC (rev 1913)
@@ -752,6 +752,10 @@
 			osrfLogToStderr();
 			params = jsonParse( OSRF_BUFFER_C_STR( buffer ) );
 			osrfRestoreLogType();
+			if( params == NULL) {
+				fprintf(stderr, "JSON error detected, not executing\n");
+				return 1;
+			}
 		}
 	} else {
 		if(!last_result || ! last_result->_result_content) { 
@@ -764,12 +768,6 @@
 		}
 	}
 
-	if(buffer->n_used > 0 && params == NULL) {
-		fprintf(stderr, "JSON error detected, not executing\n");
-		jsonObjectFree(params);
-		return 1;
-	}
-
 	int session_is_temporary;    // boolean
 	osrfAppSession* session = osrfHashGet( server_hash, server );
 	if( session ) {



More information about the opensrf-commits mailing list