From 90283926c666cb92f2686d5f9e9fbadbba8a17a9 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 7 Feb 2005 20:48:00 +0000 Subject: [PATCH] fixed some dum NULL strdup problems git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@22 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libtransport/Makefile | 4 ++++ src/libtransport/transport_client.c | 1 - src/libtransport/transport_message.c | 24 ++++++++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/libtransport/Makefile b/src/libtransport/Makefile index d18b5d4..cefee64 100644 --- a/src/libtransport/Makefile +++ b/src/libtransport/Makefile @@ -12,6 +12,10 @@ TARGETS=generic_utils.o transport_socket.o transport_message.o transport_session basic_client: lib $(CC) $(CC_OPTS) $(EXE_LD_OPTS) basic_client.c -o $@ +test: lib + $(CC) $(CC_OPTS) $(EXE_LD_OPTS) test.c -o $@ + + # --- Libs ----------------------------------------------- lib: diff --git a/src/libtransport/transport_client.c b/src/libtransport/transport_client.c index 223d47b..53e2825 100644 --- a/src/libtransport/transport_client.c +++ b/src/libtransport/transport_client.c @@ -147,7 +147,6 @@ transport_message* client_recv( transport_client* client, int timeout ) { remaining -= (int) (time(NULL) - start); } - info_handler("It took %d reads to grab this messag", counter); } /* again, see if there are any messages in the message queue */ diff --git a/src/libtransport/transport_message.c b/src/libtransport/transport_message.c index e0e1a35..c78ec62 100644 --- a/src/libtransport/transport_message.c +++ b/src/libtransport/transport_message.c @@ -165,10 +165,26 @@ transport_message* new_message_from_xml( const char* msg_xml ) { void message_set_router_info( transport_message* msg, char* router_from, char* router_to, char* router_class, char* router_command, int broadcast_enabled ) { - msg->router_from = strdup(router_from); - msg->router_to = strdup(router_to); - msg->router_class = strdup(router_class); - msg->router_command = strdup(router_command); + if(router_from) + msg->router_from = strdup(router_from); + else + msg->router_from = strdup(""); + + if(router_to) + msg->router_to = strdup(router_to); + else + msg->router_to = strdup(""); + + if(router_class) + msg->router_class = strdup(router_class); + else + msg->router_class = strdup(""); + + if(router_command) + msg->router_command = strdup(router_command); + else + msg->router_command = strdup(""); + msg->broadcast = broadcast_enabled; if( msg->router_from == NULL || msg->router_to == NULL || -- 2.11.0