File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -284,19 +284,24 @@ xp_RunFastTransfer_secure(PG_FUNCTION_ARGS)
284284 transfer_time = -1 ;
285285 total_time = -1 ;
286286
287- char * line = NULL ;
288- char * saveptr = NULL ;
289-
290- line = strtok_r (result_output -> data , "\n" , & saveptr );
291- while (line != NULL )
292- {
293- if (strstr (line , "ERROR" ) != NULL )
294- {
295- appendStringInfo (error_output , "%s\n" , line );
287+ char * start = result_output -> data ;
288+ char * end = NULL ;
289+
290+ while ((end = strchr (start , '\n' )) != NULL ) {
291+ * end = '\0' ;
292+ if (strstr (start , "ERROR" ) != NULL ) {
293+ appendStringInfo (error_output , "%s\n" , start );
296294 }
297- line = strtok_r (NULL , "\n" , & saveptr );
295+ start = end + 1 ;
296+ }
297+
298+ // If the last row doesn't have '\n'
299+ if (* start != '\0' && strstr (start , "ERROR" ) != NULL ) {
300+ appendStringInfo (error_output , "%s\n" , start );
298301 }
299302
303+
304+
300305 if (out && out [0 ] != '\0' ) {
301306 /* Total rows */
302307 token = strstr (out , "Total rows : " );
You can’t perform that action at this time.
0 commit comments