*** empty log message ***
This commit is contained in:
parent
cc3fd56f96
commit
aa4ad562c0
@ -114,8 +114,8 @@ static void doit(void);
|
|||||||
static void startup(void);
|
static void startup(void);
|
||||||
static void chkhost(struct sockaddr *_f);
|
static void chkhost(struct sockaddr *_f);
|
||||||
static int ckqueue(struct printer *_pp);
|
static int ckqueue(struct printer *_pp);
|
||||||
|
static int *socksetup(int _af, int _debuglvl);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
static int *socksetup(int _af, int _options);
|
|
||||||
|
|
||||||
/* XXX from libc/net/rcmd.c */
|
/* XXX from libc/net/rcmd.c */
|
||||||
extern int __ivaliduser_sa __P((FILE *, struct sockaddr *, socklen_t,
|
extern int __ivaliduser_sa __P((FILE *, struct sockaddr *, socklen_t,
|
||||||
@ -299,10 +299,7 @@ main(int argc, char **argv)
|
|||||||
FD_SET(funix, &defreadfds);
|
FD_SET(funix, &defreadfds);
|
||||||
listen(funix, 5);
|
listen(funix, 5);
|
||||||
if (pflag == 0) {
|
if (pflag == 0) {
|
||||||
options = SO_REUSEADDR;
|
finet = socksetup(family, socket_debug);
|
||||||
if (socket_debug)
|
|
||||||
options |= SO_DEBUG;
|
|
||||||
finet = socksetup(family, options);
|
|
||||||
} else
|
} else
|
||||||
finet = NULL; /* pretend we couldn't open TCP socket. */
|
finet = NULL; /* pretend we couldn't open TCP socket. */
|
||||||
if (finet) {
|
if (finet) {
|
||||||
@ -322,7 +319,7 @@ main(int argc, char **argv)
|
|||||||
* XXX - should be redone for multi-protocol
|
* XXX - should be redone for multi-protocol
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int domain = -1, nfds, s = -1;
|
int domain, nfds, s;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
|
|
||||||
FD_COPY(&defreadfds, &readfds);
|
FD_COPY(&defreadfds, &readfds);
|
||||||
@ -332,8 +329,8 @@ main(int argc, char **argv)
|
|||||||
syslog(LOG_WARNING, "select: %m");
|
syslog(LOG_WARNING, "select: %m");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
domain = 0; /* avoid compile-time warning */
|
domain = -1; /* avoid compile-time warning */
|
||||||
s = 0; /* avoid compile-time warning */
|
s = -1; /* avoid compile-time warning */
|
||||||
if (FD_ISSET(funix, &readfds)) {
|
if (FD_ISSET(funix, &readfds)) {
|
||||||
domain = AF_UNIX, fromlen = sizeof(fromunix);
|
domain = AF_UNIX, fromlen = sizeof(fromunix);
|
||||||
s = accept(funix,
|
s = accept(funix,
|
||||||
@ -699,7 +696,7 @@ chkhost(struct sockaddr *f)
|
|||||||
/* if af is PF_UNSPEC more than one socket may be returned */
|
/* if af is PF_UNSPEC more than one socket may be returned */
|
||||||
/* the returned list is dynamically allocated, so caller needs to free it */
|
/* the returned list is dynamically allocated, so caller needs to free it */
|
||||||
static int *
|
static int *
|
||||||
socksetup(int af, int options)
|
socksetup(int af, int debuglvl)
|
||||||
{
|
{
|
||||||
struct addrinfo hints, *res, *r;
|
struct addrinfo hints, *res, *r;
|
||||||
int error, maxs, *s, *socks;
|
int error, maxs, *s, *socks;
|
||||||
@ -732,16 +729,15 @@ socksetup(int af, int options)
|
|||||||
syslog(LOG_DEBUG, "socket(): %m");
|
syslog(LOG_DEBUG, "socket(): %m");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (options & SO_REUSEADDR)
|
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))
|
||||||
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, &on,
|
< 0) {
|
||||||
sizeof(on)) < 0) {
|
syslog(LOG_ERR, "setsockopt(SO_REUSEADDR): %m");
|
||||||
syslog(LOG_ERR, "setsockopt(SO_REUSEADDR): %m");
|
close(*s);
|
||||||
close(*s);
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
if (debuglvl)
|
||||||
if (options & SO_DEBUG)
|
if (setsockopt(*s, SOL_SOCKET, SO_DEBUG, &debuglvl,
|
||||||
if (setsockopt(*s, SOL_SOCKET, SO_DEBUG,
|
sizeof(debuglvl)) < 0) {
|
||||||
&on, sizeof(on)) < 0) {
|
|
||||||
syslog(LOG_ERR, "setsockopt (SO_DEBUG): %m");
|
syslog(LOG_ERR, "setsockopt (SO_DEBUG): %m");
|
||||||
close(*s);
|
close(*s);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user