The apcups daemon can handle it and it's nicer to the system to just leave the
socket open, so that's what we're doing. The socket is still closed if
`APCMAIN' is defined.
return (buflen);
}
+#if APCMAIN
/* Close the network connection */
static void net_close (int *fd)
{
close (*fd);
*fd = -1;
}
+#endif /* APCMAIN */
/*
* Open a TCP connection to the UPS network server
syslog (LOG_WARNING, "apcups plugin: Error reading from socket");
return (-1);
}
+#if APCMAIN
else
{
/* close the opened socket */
net_close (&sockfd);
}
+#endif /* APCMAIN */
return (0);
}