From e208feedae5de4db0a68c109769603286f78d436 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 20 Feb 2008 22:35:20 +0000 Subject: [PATCH] Corrected a couple of comparisons, and made the socket init more complete. --- bacnet-stack/ports/linux/dlmstp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bacnet-stack/ports/linux/dlmstp.c b/bacnet-stack/ports/linux/dlmstp.c index 40df5b82..13a99546 100644 --- a/bacnet-stack/ports/linux/dlmstp.c +++ b/bacnet-stack/ports/linux/dlmstp.c @@ -149,7 +149,7 @@ uint16_t dlmstp_receive( int max = 0; /* Make sure the socket is open */ - if (Receive_Client_SockFD <= 0) + if (Receive_Client_SockFD < 0) return 0; if (timeout >= 1000) { @@ -303,7 +303,7 @@ int dlmstp_get_transmit_packet( int max = 0; /* Make sure the socket is open */ - if (Transmit_Client_SockFD <= 0) + if (Transmit_Client_SockFD < 0) return 0; if (timeout >= 1000) { @@ -672,6 +672,7 @@ static int create_named_server_socket( } setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &sock, sizeof(sock)); /* Bind a name to the socket. */ + bzero((char *)&name, sizeof(name)); name.sun_family = AF_LOCAL; strncpy(name.sun_path, filename, sizeof(name.sun_path)); /* The size of the address is @@ -710,6 +711,8 @@ static int connect_named_server_socket( #endif exit(EXIT_FAILURE); } + bzero((char *)&name, sizeof(name)); + name.sun_family = AF_LOCAL; strncpy(name.sun_path, filename, sizeof(name.sun_path)); /* The size of the address is the offset of the start of the filename,