Do not depend on the global 'sockt' being initialized to 0;

instead, use the symbolic constant STDIN_FILENO, as this is
a daemon invoked from inetd.
Remove 'sockt' as it is not referenced.
This commit is contained in:
Bruce M Simpson 2004-06-14 22:43:05 +00:00
parent 9d61853d9f
commit 17d7976856
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130495

View File

@ -72,7 +72,6 @@ static const char rcsid[] =
CTL_MSG request;
CTL_RESPONSE response;
int sockt;
int debug = 0;
long lastmsgtime;
@ -122,8 +121,8 @@ main(int argc, char *argv[])
ctl_addr.sa_len = sizeof(ctl_addr);
process_request(mp, &response);
/* can block here, is this what I want? */
cc = sendto(sockt, (char *)&response, sizeof (response), 0,
&ctl_addr, sizeof (ctl_addr));
cc = sendto(STDIN_FILENO, (char *)&response,
sizeof (response), 0, &ctl_addr, sizeof (ctl_addr));
if (cc != sizeof (response))
syslog(LOG_WARNING, "sendto: %m");
}