X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Fisrv_identd.c;h=9bc3b607d15e15ad8f17654de51cf13e318fc847;hb=88ce2748e4c26991facfa57f89f2b2637bd8fa73;hp=f9ab0b2c0e291648591a8c95fa56afeaff1912bc;hpb=06af2165288cd6516b89001ec9e24992619230e0;p=oweals%2Fbusybox.git diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index f9ab0b2c0..9bc3b607d 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -8,7 +8,7 @@ */ #include -#include "busybox.h" +#include "libbb.h" #include "isrv.h" enum { TIMEOUT = 20 }; @@ -19,7 +19,7 @@ typedef struct identd_buf_t { char buf[64 - 2*sizeof(int)]; } identd_buf_t; -static const char *bogouser = "nobody"; +#define bogouser bb_common_bufsiz1 static int new_peer(isrv_state_t *state, int fd) { @@ -32,7 +32,7 @@ static int new_peer(isrv_state_t *state, int fd) if (isrv_register_fd(state, peer, fd) < 0) return peer; /* failure, unregister peer */ - buf->fd_flag = fcntl(fd, F_GETFL, 0) | O_NONBLOCK; + buf->fd_flag = fcntl(fd, F_GETFL) | O_NONBLOCK; isrv_want_rd(state, fd); return 0; } @@ -107,12 +107,15 @@ int fakeidentd_main(int argc, char **argv) unsigned opt; int fd; - opt = getopt32(argc, argv, "fiwb:", &bind_address); - if (optind < argc) - bogouser = argv[optind]; + opt = getopt32(argv, "fiwb:", &bind_address); + strcpy(bogouser, "nobody"); + if (argv[optind]) + strncpy(bogouser, argv[optind], sizeof(bogouser)); /* Daemonize if no -f and no -i and no -w */ - bb_sanitize_stdio_maybe_daemonize(!(opt & OPT_fiw)); + if (!(opt & OPT_fiw)); + bb_daemonize_or_rexec(0, argv); + /* Where to log in inetd modes? "Classic" inetd * probably has its stderr /dev/null'ed (we need log to syslog?), * but daemontools-like utilities usually expect that children