summaryrefslogtreecommitdiffstats
path: root/plugins/netutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/netutils.c')
-rw-r--r--plugins/netutils.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 4804218..83f8942 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -167,10 +167,9 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
167 char port_str[6], host[MAX_HOST_ADDRESS_LENGTH]; 167 char port_str[6], host[MAX_HOST_ADDRESS_LENGTH];
168 size_t len; 168 size_t len;
169 int socktype, result; 169 int socktype, result;
170 bool is_socket; 170 short is_socket = (host_name[0] == '/');
171 171
172 socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM; 172 socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
173 bool is_socket = (host_name[0] == '/');
174 173
175 /* as long as it doesn't start with a '/', it's assumed a host or ip */ 174 /* as long as it doesn't start with a '/', it's assumed a host or ip */
176 if (!is_socket){ 175 if (!is_socket){
@@ -256,7 +255,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
256 break; 255 break;
257 case STATE_CRITICAL: /* user did not set econn_refuse_state */ 256 case STATE_CRITICAL: /* user did not set econn_refuse_state */
258 if (is_socket) 257 if (is_socket)
259 printf("connect to socket %s: %s\n", host_name, strerror(errno)); 258 printf("connect to file socket %s: %s\n", host_name, strerror(errno));
260 else 259 else
261 printf("connect to address %s and port %d: %s\n", 260 printf("connect to address %s and port %d: %s\n",
262 host_name, port, strerror(errno)); 261 host_name, port, strerror(errno));
@@ -269,7 +268,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
269 } 268 }
270 else { 269 else {
271 if (is_socket) 270 if (is_socket)
272 printf("connect to socket %s: %s\n", host_name, strerror(errno)); 271 printf("connect to file socket %s: %s\n", host_name, strerror(errno));
273 else 272 else
274 printf("connect to address %s and port %d: %s\n", 273 printf("connect to address %s and port %d: %s\n",
275 host_name, port, strerror(errno)); 274 host_name, port, strerror(errno));