summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorabrist <abrist@nagios.com>2014-05-19 16:16:40 -0400
committerJan Wagner <waja@cyconet.org>2014-07-29 11:09:43 +0200
commitfc2c099d58eeb32350a6b147db067d179d8debb6 (patch)
tree885187d1553fb5a3aae11e45dc52b2c67d3d3901 /plugins
parente85fcbd5711999af88ed887c0c17a26ab29f2b28 (diff)
downloadmonitoring-plugins-fc2c099d58eeb32350a6b147db067d179d8debb6.tar.gz
netutils.c - A few more changes
Changed bool to short. Removed first instance of is_socket to avoid redeclaration error. Changed 'socket' to 'file socket' for verbosity.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/netutils.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 48042188..83f8942f 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));