diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-21 02:28:33 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-21 02:28:33 +0000 |
commit | b65f17cad5cd5c3e59274e3676ee62c8b5987c2c (patch) | |
tree | ce4db68f5323aff23f21ff671a99390a4ef8e5db /libexec/talkd | |
parent | 03e3e41d6a064091022b45c4fad1002687012e0f (diff) |
o Use *_FILENO defines instead of numbers
o Kill sockt global, it is not needed
o Use STDOUT_FILENO as the 1st arg to sendto().
Previously we used sockt in sendto() which only worked because a) globals
are intialized to 0 and b) inetd sets up fds 0-2 dup'd to the same thing
so it didn't matter that we were sending to stdin, not stdout.
Diffstat (limited to 'libexec/talkd')
-rw-r--r-- | libexec/talkd/talkd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c index 1e61c8377eb..041e3a0bd74 100644 --- a/libexec/talkd/talkd.c +++ b/libexec/talkd/talkd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: talkd.c,v 1.11 2002/05/16 12:16:16 deraadt Exp $ */ +/* $OpenBSD: talkd.c,v 1.12 2002/06/21 02:28:32 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)talkd.c 5.8 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$Id: talkd.c,v 1.11 2002/05/16 12:16:16 deraadt Exp $"; +static char rcsid[] = "$Id: talkd.c,v 1.12 2002/06/21 02:28:32 millert Exp $"; #endif /* not lint */ /* @@ -65,7 +65,6 @@ static char rcsid[] = "$Id: talkd.c,v 1.11 2002/05/16 12:16:16 deraadt Exp $"; #include <paths.h> #include "talkd.h" -int sockt; int debug = 0; void timeout(); long lastmsgtime; @@ -104,8 +103,9 @@ main(argc, argv) int cc, len = sizeof(response.addr); CTL_MSG request; - cc = recvfrom(0, (char *)&request, sizeof (request), 0, - (struct sockaddr *)&response.addr, &len); + cc = recvfrom(STDIN_FILENO, (char *)&request, + sizeof (request), 0, (struct sockaddr *)&response.addr, + &len); if (cc != sizeof (request)) { if (cc < 0 && errno != EINTR) syslog(LOG_WARNING, "recvfrom: %m"); @@ -119,7 +119,7 @@ main(argc, argv) lastmsgtime = time(0); process_request(&request, &response); /* can block here, is this what I want? */ - cc = sendto(sockt, (char *)&response, + cc = sendto(STDOUT_FILENO, (char *)&response, sizeof (response), 0, (struct sockaddr *)&request.ctl_addr, sizeof (request.ctl_addr)); if (cc != sizeof (response)) |