fixed some dum NULL strdup problems
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 7 Feb 2005 20:48:00 +0000 (20:48 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 7 Feb 2005 20:48:00 +0000 (20:48 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@22 9efc2488-bf62-4759-914b-345cdb29e865

src/libtransport/Makefile
src/libtransport/transport_client.c
src/libtransport/transport_message.c

index d18b5d4..cefee64 100644 (file)
@@ -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: 
index 223d47b..53e2825 100644 (file)
@@ -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 */
index e0e1a35..c78ec62 100644 (file)
@@ -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 ||