aboutsummaryrefslogtreecommitdiff
path: root/plugins/netutils.c
diff options
context:
space:
mode:
authorGravatar abrist <abrist@nagios.com> 2014-05-19 16:16:40 -0400
committerGravatar Jan Wagner <waja@cyconet.org> 2014-07-29 11:09:43 +0200
commitfc2c099d58eeb32350a6b147db067d179d8debb6 (patch)
tree885187d1553fb5a3aae11e45dc52b2c67d3d3901 /plugins/netutils.c
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/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 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)
char port_str[6], host[MAX_HOST_ADDRESS_LENGTH];
size_t len;
int socktype, result;
- bool is_socket;
+ short is_socket = (host_name[0] == '/');
socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
- bool is_socket = (host_name[0] == '/');
/* as long as it doesn't start with a '/', it's assumed a host or ip */
if (!is_socket){
@@ -256,7 +255,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
break;
case STATE_CRITICAL: /* user did not set econn_refuse_state */
if (is_socket)
- printf("connect to socket %s: %s\n", host_name, strerror(errno));
+ printf("connect to file socket %s: %s\n", host_name, strerror(errno));
else
printf("connect to address %s and port %d: %s\n",
host_name, port, strerror(errno));
@@ -269,7 +268,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
}
else {
if (is_socket)
- printf("connect to socket %s: %s\n", host_name, strerror(errno));
+ printf("connect to file socket %s: %s\n", host_name, strerror(errno));
else
printf("connect to address %s and port %d: %s\n",
host_name, port, strerror(errno));