diff --git a/CHANGES b/CHANGES index 3014e2a..e081438 100644 --- a/CHANGES +++ b/CHANGES @@ -83,6 +83,8 @@ Coding: Stream dump write now warn on write errors and partial writes (but still do not recover). + Removed trailing white space from *.h and *.c files. + Porting: Small correction in configure.ac makes Socat C99 able. Thanks to Florian Weimer from Red Hat for providing a patch. diff --git a/fdname.c b/fdname.c index 1d32edc..d827a94 100644 --- a/fdname.c +++ b/fdname.c @@ -89,7 +89,7 @@ static int procgetfdname(int fd, char *filepath, size_t pathsize) { } } #endif /* !HAVE_STAT64 */ - + if (pid < 0) pid = Getpid(); snprintf(procpath, sizeof(procpath), "/proc/"F_pid"/" #if HAVE_PROC_DIR_PATH @@ -107,7 +107,7 @@ static int procgetfdname(int fd, char *filepath, size_t pathsize) { return 0; } #endif /* HAVE_PROC_DIR_FD || HAVE_PROC_DIR_PATH */ - + int statname(const char *file, int fd, int filetype, FILE *outfile, char style) { char filepath[PATH_MAX]; @@ -229,7 +229,7 @@ int sockname(int fd, FILE *outfile, char style) { #if HAVE_GETPROTOBYNUMBER || HAVE_GETPROTOBYNUMBER_R struct protoent protoent, *protoentp; #endif -#define PROTONAMEMAX 1024 +#define PROTONAMEMAX 1024 char protoname[PROTONAMEMAX] = ""; #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) int proto = 0; @@ -304,8 +304,8 @@ int sockname(int fd, FILE *outfile, char style) { } #else switch (proto) { - case IPPROTO_TCP: strcpy(protoname, "tcp"); break; - case IPPROTO_UDP: strcpy(protoname, "udp"); break; + case IPPROTO_TCP: strcpy(protoname, "tcp"); break; + case IPPROTO_UDP: strcpy(protoname, "udp"); break; case IPPROTO_SCTP: strcpy(protoname, "sctp"); break; default: sprintf(protoname, "proto%d", proto); break; } diff --git a/filan.c b/filan.c index b965eba..18b2bf4 100644 --- a/filan.c +++ b/filan.c @@ -3,7 +3,7 @@ /* Published under the GNU General Public License V.2, see file COPYING */ /* the subroutine filan makes a "FILe descriptor ANalysis". It checks the - type of file descriptor and tries to retrieve as much info about it as + type of file descriptor and tries to retrieve as much info about it as possible without modifying its state. NOTE: it works on UNIX (kernel) file descriptors, not on libc files! */ @@ -79,7 +79,7 @@ int filan_file(const char *filename, FILE *outfile) { default: if ((fd = Open(filename, O_RDONLY|O_NOCTTY|O_NONBLOCK -#ifdef O_NOFOLLOW +#ifdef O_NOFOLLOW |(filan_followsymlinks?0:O_NOFOLLOW) #endif #ifdef O_LARGEFILE @@ -91,7 +91,7 @@ int filan_file(const char *filename, FILE *outfile) { filename, strerror(errno)); } } - + result = filan_stat(&buf, fd, -1, outfile, filename); fputc('\n', outfile); return result; @@ -200,7 +200,7 @@ int filan_fd(int fd, FILE *outfile) { } } #endif /* _WITH_SOCKET && defined(MSG_DONTWAIT) */ - } + } #endif /* HAVE_POLL */ } } @@ -642,7 +642,7 @@ int sockan(int fd, FILE *outfile) { # define TYPENAMEMAX 16 char typename[TYPENAMEMAX]; sockettype(*optval.i, typename, sizeof(typename)); - + Debug3("fd %d: socket of type %d (\"%s\")", fd, *optval.i, typename); } @@ -790,7 +790,7 @@ int ipan(int fd, FILE *outfile) { const struct sockopt *optname; int optproto; socklen_t optlen = sizeof(optproto); - + optname = ipopts; while (optname->so) { sockoptan(fd, optname, SOL_IP, outfile); ++optname; @@ -825,7 +825,7 @@ int ip6an(int fd, FILE *outfile) { #endif {0, NULL} } ; const struct sockopt *optname; - + optname = ip6opts; while (optname->so) { sockoptan(fd, optname, SOL_IPV6, outfile); ++optname; @@ -1059,4 +1059,4 @@ static int printtime(FILE *outfile, time_t time) { fputs(s, outfile); } return 0; -} +} diff --git a/nestlex.c b/nestlex.c index b64dd38..19d3381 100644 --- a/nestlex.c +++ b/nestlex.c @@ -73,7 +73,7 @@ static int _nestlex(const char **addr, /* is this end of input string? */ if (*in == 0) { - + break; /* end of string */ } @@ -123,7 +123,7 @@ static int _nestlex(const char **addr, if (--*len <= 0) { *addr = in; *token = out; return -1; } } } - + break; } ++quotx; diff --git a/socat.c b/socat.c index f65fe75..44b7f64 100644 --- a/socat.c +++ b/socat.c @@ -230,7 +230,7 @@ int main(int argc, const char *argv[]) { rto = Strtod(a, (char **)&a, "-t"); socat_opts.closwait.tv_sec = rto; socat_opts.closwait.tv_usec = - (rto-socat_opts.closwait.tv_sec) * 1000000; + (rto-socat_opts.closwait.tv_sec) * 1000000; break; case 'T': if (arg1[0][2]) { a = *arg1+2; @@ -244,7 +244,7 @@ int main(int argc, const char *argv[]) { rto = Strtod(a, (char **)&a, "-T"); socat_opts.total_timeout.tv_sec = rto; socat_opts.total_timeout.tv_usec = - (rto-socat_opts.total_timeout.tv_sec) * 1000000; + (rto-socat_opts.total_timeout.tv_sec) * 1000000; break; case 'u': if (arg1[0][2]) { socat_opt_hint(stderr, arg1[0][1], arg1[0][2]); Exit(1); } socat_opts.lefttoright = true; break; @@ -738,8 +738,7 @@ int socat(const char *address1, const char *address2) { #endif Info("resolved and opened all sock addresses"); - return - _socat(); /* nsocks, sockets are visible outside function */ + return _socat(); /* nsocks, sockets are visible outside function */ } /* checks if this is a connection to a child process, and if so, sees if the @@ -1041,7 +1040,7 @@ int _socat(void) { if (closing) { break; } - /* one possibility to come here is ignoreeof on some fd, but no EOF + /* one possibility to come here is ignoreeof on some fd, but no EOF and no data on any descriptor - this is no indication for end! */ continue; } @@ -1051,7 +1050,7 @@ int _socat(void) { if (fd1in->revents & POLLNVAL) { /* this is what we find on Mac OS X when poll()'ing on a device or named pipe. a read() might imm. return with 0 bytes, resulting - in a loop? */ + in a loop? */ Error1("poll(...[%d]: invalid request", fd1in->fd); free(buff); return -1; @@ -1137,7 +1136,7 @@ int _socat(void) { XIO_RDSTREAM(sock2)->actbytes == 0) { /* avoid idle when all readbytes already there */ mayrd2 = true; - } + } /* escape char occurred? */ if (XIO_RDSTREAM(sock2)->actescape) { bytes2 = 0; /* indicate EOF */ @@ -1287,7 +1286,7 @@ static int /* inpipe is suspected to have read data available; read at most bufsiz bytes and transfer them to outpipe. Perform required data conversions. buff must be a malloc()'ed storage and might be realloc()'ed in this - function if more space is required after conversions. + function if more space is required after conversions. Returns the number of bytes written, or 0 on EOF or <0 if an error occurred or when data was read but none written due to conversions (with EAGAIN). EAGAIN also occurs when reading from a nonblocking FD where @@ -1571,7 +1570,7 @@ void socat_signal(int signum) { break; case SIGTERM: Warn1("exiting on signal %d", signum); break; - case SIGHUP: + case SIGHUP: case SIGINT: Notice1("exiting on signal %d", signum); break; } diff --git a/sslcls.c b/sslcls.c index 0bf430d..377a958 100644 --- a/sslcls.c +++ b/sslcls.c @@ -348,7 +348,7 @@ int sycSSL_connect(SSL *ssl) { Debug1("SSL_connect(%p)", ssl); result = SSL_connect(ssl); Debug1("SSL_connect() -> %d", result); - return result; + return result; } int sycSSL_accept(SSL *ssl) { @@ -356,7 +356,7 @@ int sycSSL_accept(SSL *ssl) { Debug1("SSL_accept(%p)", ssl); result = SSL_accept(ssl); Debug1("SSL_accept() -> %d", result); - return result; + return result; } int sycSSL_read(SSL *ssl, void *buf, int num) { @@ -392,7 +392,7 @@ X509 *sycSSL_get_peer_certificate(SSL *ssl) { } else { Debug("SSL_get_peer_certificate() -> NULL"); } - return result; + return result; } int sycSSL_shutdown(SSL *ssl) { diff --git a/sycls.c b/sycls.c index 083cf1a..5d137c0 100644 --- a/sycls.c +++ b/sycls.c @@ -1097,13 +1097,13 @@ int Connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen) { Debug18("connect(%d,{0x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x}, "F_Zd")", sockfd, ((unsigned char *)serv_addr)[0], ((unsigned char *)serv_addr)[1], - ((unsigned char *)serv_addr)[2], ((unsigned char *)serv_addr)[3], - ((unsigned char *)serv_addr)[4], ((unsigned char *)serv_addr)[5], - ((unsigned char *)serv_addr)[6], ((unsigned char *)serv_addr)[7], - ((unsigned char *)serv_addr)[8], ((unsigned char *)serv_addr)[9], - ((unsigned char *)serv_addr)[10], ((unsigned char *)serv_addr)[11], - ((unsigned char *)serv_addr)[12], ((unsigned char *)serv_addr)[13], - ((unsigned char *)serv_addr)[14], ((unsigned char *)serv_addr)[15], + ((unsigned char *)serv_addr)[2], ((unsigned char *)serv_addr)[3], + ((unsigned char *)serv_addr)[4], ((unsigned char *)serv_addr)[5], + ((unsigned char *)serv_addr)[6], ((unsigned char *)serv_addr)[7], + ((unsigned char *)serv_addr)[8], ((unsigned char *)serv_addr)[9], + ((unsigned char *)serv_addr)[10], ((unsigned char *)serv_addr)[11], + ((unsigned char *)serv_addr)[12], ((unsigned char *)serv_addr)[13], + ((unsigned char *)serv_addr)[14], ((unsigned char *)serv_addr)[15], addrlen); #else Debug4("connect(%d, {%d,%s}, "F_socklen")", @@ -1536,7 +1536,7 @@ int Tcgetattr(int fd, struct termios *termios_p) { #else Debug6("tcgetattr(, {%08x,%08x,%08x,%08x,%s}) -> %d", termios_p->c_iflag, termios_p->c_oflag, - termios_p->c_cflag, termios_p->c_lflag, + termios_p->c_cflag, termios_p->c_lflag, chars, result); #endif errno = _errno; diff --git a/sysutils.c b/sysutils.c index a691659..b89e9a9 100644 --- a/sysutils.c +++ b/sysutils.c @@ -661,7 +661,7 @@ int xiopoll(struct pollfd fds[], unsigned long nfds, struct timeval *timeout) { #endif /* !HAVE_POLL */ } } - + #if WITH_TCP || WITH_UDP /* returns port in network byte order; diff --git a/vsnprintf_r.c b/vsnprintf_r.c index 3b691c8..5b4b518 100644 --- a/vsnprintf_r.c +++ b/vsnprintf_r.c @@ -78,11 +78,11 @@ static char *diag_ulong_to_dec(char *field, size_t n, unsigned long ulo, int lea while (--i >= 0) { *--np = c; } - } + } return np; } -/* this function converts a signed long number to decimal ASCII +/* this function converts a signed long number to decimal ASCII and pads it with space or '0' when size and leading0 are set appropriately it is async signal safe and thread safe it returns NULL if n==0 @@ -110,7 +110,7 @@ static char *diag_long_to_dec(char *field, size_t n, long lo, int leading0, int if (size >= n) size = n-1; i = size - strlen(np); if (leading0) { - if (minus) --i; + if (minus) --i; while (--i >= 0) { *--np = '0'; } @@ -156,7 +156,7 @@ static char *diag_ulong_to_hex(char *field, size_t n, unsigned long ulo, int lea while (--i >= 0) { *--np = c; } - } + } return np; } @@ -188,7 +188,7 @@ static char *diag_ulong_to_oct(char *field, size_t n, unsigned long ulo, int lea while (--i >= 0) { *--np = c; } - } + } return np; } @@ -240,11 +240,11 @@ static char *diag_ulonglong_to_dec(char *field, size_t n, unsigned long long ull while (i-- > 0) { *--np = c; } - } + } return np; } -/* this function converts a signed long long number to decimal ASCII +/* this function converts a signed long long number to decimal ASCII and pads it with space or '0' when size and leading0 are set appropriately it is async signal safe and thread safe it returns NULL if n==0 @@ -272,7 +272,7 @@ static char *diag_longlong_to_dec(char *field, size_t n, long long ll, int leadi if (size >= n) size = n-1; i = size - strlen(np); if (leading0) { - if (minus) --i; + if (minus) --i; while (--i >= 0) { *--np = '0'; } @@ -283,7 +283,7 @@ static char *diag_longlong_to_dec(char *field, size_t n, long long ll, int leadi *--np = ' '; } } - } + } return np; } @@ -316,7 +316,7 @@ static char *diag_ulonglong_to_hex(char *field, size_t n, unsigned long long ull while (i-- > 0) { *--np = c; } - } + } return np; } @@ -348,7 +348,7 @@ static char *diag_ulonglong_to_oct(char *field, size_t n, unsigned long long ull while (--i >= 0) { *--np = c; } - } + } return np; } @@ -369,7 +369,7 @@ int vsnprintf_r(char *str, size_t size, const char *format, va_list ap) { --size; /* without trailing \0 */ while (c = *format++) { if (c == '\\') { - + } else if (c == '%') { #if HAVE_TYPE_LONGLONG # define num_buff_len ((sizeof(unsigned long long)*8+2)/3+1) /* hold up to u long long in octal w/ \0 */ @@ -389,7 +389,7 @@ int vsnprintf_r(char *str, size_t size, const char *format, va_list ap) { c = *format++; if (c == '\0') { break; } - + /* flag characters */ switch (c) { case '0': leading0 = 1; c = *format++; break; @@ -423,13 +423,13 @@ int vsnprintf_r(char *str, size_t size, const char *format, va_list ap) { case 'h': lengthmod = c; if ((c = *format++) == 'h') { - lengthmod = 'H'; c = *format++; + lengthmod = 'H'; c = *format++; } break; - case 'l': + case 'l': lengthmod = c; if ((c = *format++) == 'l') { - lengthmod = 'L'; c = *format++; + lengthmod = 'L'; c = *format++; } break; } diff --git a/xio-exec.c b/xio-exec.c index c73faf8..05f8f96 100644 --- a/xio-exec.c +++ b/xio-exec.c @@ -37,7 +37,7 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts, if (argc != 2) { Error3("\"%s:%s\": wrong number of parameters (%d instead of 1)", argv[0], argv[1], argc-1); } - + retropt_bool(opts, OPT_DASH, &dash); status = _xioopen_foxec(xioflags, &fd->stream, groups, &opts, &duptostderr); @@ -126,11 +126,17 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts, Execvp(token, pargv); /* here we come only if execvp() failed */ switch (pargc) { - case 1: Error3("execvp(\"%s\", \"%s\"): %s", token, pargv[0], strerror(errno)); break; - case 2: Error4("execvp(\"%s\", \"%s\", \"%s\"): %s", token, pargv[0], pargv[1], strerror(errno)); break; + case 1: + Error3("execvp(\"%s\", \"%s\"): %s", + token, pargv[0], strerror(errno)); break; + case 2: + Error4("execvp(\"%s\", \"%s\", \"%s\"): %s", + token, pargv[0], pargv[1], strerror(errno)); break; case 3: default: - Error5("execvp(\"%s\", \"%s\", \"%s\", \"%s\", ...): %s", token, pargv[0], pargv[1], pargv[2], strerror(errno)); break; + Error5("execvp(\"%s\", \"%s\", \"%s\", \"%s\", ...): %s", token, + pargv[0], pargv[1], pargv[2], strerror(errno)); + break; } Exit(1); /* this child process */ } diff --git a/xio-gopen.c b/xio-gopen.c index 1d8f23e..370de60 100644 --- a/xio-gopen.c +++ b/xio-gopen.c @@ -112,7 +112,7 @@ static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xio applyopts_cloexec(fd->stream.fd, opts); } - if ((result = applyopts2(fd->stream.fd, opts, PH_PASTSOCKET, PH_CONNECTED)) < 0) + if ((result = applyopts2(fd->stream.fd, opts, PH_PASTSOCKET, PH_CONNECTED)) < 0) return result; if ((result = _xio_openlate(&fd->stream, opts)) < 0) diff --git a/xio-ip.c b/xio-ip.c index 690caa0..94abdeb 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -187,7 +187,7 @@ int xiogetaddrinfo(const char *node, const char *service, Warn2("xiogetaddrinfo(, \"%s\", ...): extra trailing data \"%s\"", service, extra); } - service = NULL; + service = NULL; } /* the resolver functions might handle numeric forms of node names by @@ -448,7 +448,7 @@ int xiogetaddrinfo(const char *node, const char *service, case PF_INET6: sau->ip6.sin6_port = port; break; #endif /* WITH_IP6 */ } - } + } #endif /* WITH_TCP || WITH_UDP */ if (numnode) free(numnode); @@ -506,7 +506,7 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num, *num = 3; typbuff[0] = '\0'; strncat(typbuff, "IP_PKTINFO", typlen-1); snprintf(nambuff, namlen, "%s%c%s%c%s", "if", '\0', "locaddr", '\0', "dstaddr"); - snprintf(envbuff, envlen, "%s%c%s%c%s", "IP_IF", '\0', + snprintf(envbuff, envlen, "%s%c%s%c%s", "IP_IF", '\0', "IP_LOCADDR", '\0', "IP_DSTADDR"); snprintf(valbuff, vallen, "%s%c%s%c%s", xiogetifname(pktinfo->ipi_ifindex, scratch1, -1), '\0', diff --git a/xio-ip6.c b/xio-ip6.c index 8754198..98e5c7a 100644 --- a/xio-ip6.c +++ b/xio-ip6.c @@ -228,7 +228,7 @@ int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange *range) { masked.u6_addr32[1] != rangeaddr->u6_addr32[1] || masked.u6_addr32[2] != rangeaddr->u6_addr32[2] || masked.u6_addr32[3] != rangeaddr->u6_addr32[3]) { - Debug1("client address %s is not permitted", peername); + Debug1("client address %s is not permitted", peername); return -1; } return 0; diff --git a/xio-named.c b/xio-named.c index 4dcb327..a9c306f 100644 --- a/xio-named.c +++ b/xio-named.c @@ -85,7 +85,7 @@ int applyopts_named(const char *filename, struct opt *opts, unsigned int phase) } -/* perform actions that are common to all NAMED group addresses: checking if +/* perform actions that are common to all NAMED group addresses: checking if the entry exists, parsing options, ev.removing old filesystem entry or setting early owners and permissions. It applies options of PH_EARLY and PH_PREOPEN. diff --git a/xio-openssl.c b/xio-openssl.c index e7931b4..042d97b 100644 --- a/xio-openssl.c +++ b/xio-openssl.c @@ -21,7 +21,7 @@ #include "xio-openssl.h" /* the openssl library requires a file descriptor for external communications. - so our best effort is to provide any possible kind of un*x file descriptor + so our best effort is to provide any possible kind of un*x file descriptor (not only tcp, but also pipes, stdin, files...) for tcp we want to provide support for socks and proxy. read and write functions must use the openssl crypt versions. @@ -261,7 +261,7 @@ static int retropt_bool(opts, OPT_OPENSSL_NO_SNI, &opt_no_sni); retropt_string(opts, OPT_OPENSSL_SNIHOST, (char **)&opt_snihost); #endif - + if (opt_commonname == NULL) { opt_commonname = strdup(hostname); if (opt_commonname == NULL) { @@ -530,7 +530,7 @@ static int #else pf = PF_INET; #endif - + portname = argv[1]; xfd->howtoend = END_SHUTDOWN; @@ -1643,7 +1643,7 @@ static bool openssl_check_peername(X509_NAME *name, const char *peername) { const unsigned char *text; ind = X509_NAME_get_index_by_NID(name, NID_commonName, -1); if (ind < 0) { - Info("no COMMONNAME field in peer certificate"); + Info("no COMMONNAME field in peer certificate"); return false; } entry = X509_NAME_get_entry(name, ind); @@ -1740,7 +1740,7 @@ static int openssl_handle_peer_certificate(struct single *xfd, extstr = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); if (!strcasecmp(extstr, "subjectAltName")) { void *names; - if (!(meth = X509V3_EXT_get(ext))) break; + if (!(meth = X509V3_EXT_get(ext))) break; names = X509_get_ext_d2i(peer_cert, NID_subject_alt_name, NULL, NULL); if (names) { int numalts; diff --git a/xio-progcall.c b/xio-progcall.c index 19d329a..6daf14c 100644 --- a/xio-progcall.c +++ b/xio-progcall.c @@ -484,7 +484,7 @@ int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */ /*0 Info2("dup(%d) -> %d", rdpip[1], tmpo);*/ wrpip[0] = tmpo; } - + if (rw != XIO_WRONLY && rdpip[1] != fdo) { /* make sure that the internal diagnostic socket pair fds do not conflict with our choices */ diff --git a/xio-proxy.c b/xio-proxy.c index 67a9d8c..e22588c 100644 --- a/xio-proxy.c +++ b/xio-proxy.c @@ -220,7 +220,7 @@ static int xioopen_proxy_connect(int argc, const char *argv[], struct opt *opts, { break; } - + } while (true); /* end of complete open loop - drop out on success */ Notice4("successfully connected to %s:%u via proxy %s:%s", @@ -258,7 +258,7 @@ int _xioopen_proxy_prepare(struct proxyvars *proxyvars, struct opt *opts, Error2("open(\"%s\", O_RDONLY): %s", proxyvars->authfile, strerror(errno)); return STAT_NORETRY; } - /* go to the end of our proxy auth file to + /* go to the end of our proxy auth file to figure out how long our proxy auth is */ if ((length = Lseek(authfd, 0, SEEK_END)) < 0) { Error2("lseek(<%s>, 0, SEEK_END): %s", @@ -323,7 +323,7 @@ int _xioopen_proxy_connect(struct single *xfd, int rv; char buff[BUFLEN+1]; /* for receiving HTTP reply headers */ #if CONNLEN > BUFLEN -#error not enough buffer space +#error not enough buffer space #endif char textbuff[2*BUFLEN+1]; /* just for sanitizing print data */ char *eol = buff; @@ -410,7 +410,7 @@ int _xioopen_proxy_connect(struct single *xfd, state = XIOSTATE_ERROR; break; /* leave read cycles */ } - + switch (state) { case XIOSTATE_HTTP1: @@ -448,7 +448,7 @@ int _xioopen_proxy_connect(struct single *xfd, } state = XIOSTATE_HTTP4; break; - + case XIOSTATE_HTTP4: /* within header */ if (*(buff+offset) == '\r') { @@ -564,7 +564,7 @@ int _xioopen_proxy_connect(struct single *xfd, */ ptr += 3; while (*ptr == ' ') ++ptr; - + Msg2(level, "%s: %s", request, ptr); return STAT_RETRYLATER; } diff --git a/xio-pty.c b/xio-pty.c index e502f26..88a8782 100644 --- a/xio-pty.c +++ b/xio-pty.c @@ -43,7 +43,7 @@ static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xiofl bool opt_unlink_close = true; /* remove symlink afterwards */ bool wait_slave = false; /* true would be better for many platforms, but some OSes cannot handle this, and for common - default behaviour as well as backward + default behaviour as well as backward compatibility we choose "no" as default */ struct timespec pollintv = { PTY_INTERVALL }; diff --git a/xio-rawip.c b/xio-rawip.c index 15747c0..ed9119a 100644 --- a/xio-rawip.c +++ b/xio-rawip.c @@ -82,7 +82,7 @@ int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts, } /* - applies and consumes the following options: + applies and consumes the following options: PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECTED, PH_LATE OFUNC_OFFSET OPT_PROTOCOL_FAMILY, OPT_BIND, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_USER, diff --git a/xio-socket.c b/xio-socket.c index d8c5d47..8f14269 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -51,7 +51,7 @@ int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts, int dummy1, int socktype, int dummy3); static int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts, - int xioflags, xiofile_t *xfd, unsigned groups, + int xioflags, xiofile_t *xfd, unsigned groups, int dumy1, int dummy2, int dummy3); static @@ -257,7 +257,7 @@ int xioopen_socket_connect(int argc, const char *argv[], struct opt *opts, Error1("data too long: \"%s\"", address); } else if (result > 0) { Error1("syntax error in \"%s\"", address); - } + } them.soa.sa_family = pf; themlen = themsize + #if HAVE_STRUCT_SOCKADDR_SALEN @@ -522,7 +522,7 @@ int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts, Error1("data too long: \"%s\"", address); } else if (result > 0) { Error1("syntax error in \"%s\"", address); - } + } us->soa.sa_family = pf; uslen = ussize + sizeof(us->soa.sa_family) #if HAVE_STRUCT_SOCKADDR_SALEN @@ -599,7 +599,7 @@ int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts, Error1("data too long: \"%s\"", address); } else if (result > 0) { Error1("syntax error in \"%s\"", address); - } + } us.soa.sa_family = pf; uslen = ussize + sizeof(sa_family_t) #if HAVE_STRUCT_SOCKADDR_SALEN @@ -751,10 +751,10 @@ int xiogetpacketinfo(int fd) /* A subroutine that is common to all socket addresses that want to connect() a socket to a peer. - Applies and consumes the following options: + Applies and consumes the following options: PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECT, PH_CONNECTED, PH_LATE, - OFUNC_OFFSET, + OFUNC_OFFSET, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_USER, OPT_GROUP, OPT_CLOEXEC Does not fork, does not retry. returns 0 on success. @@ -777,7 +777,7 @@ int _xioopen_connect(struct single *xfd, union sockaddr_union *us, size_t uslen, #endif if ((xfd->fd = xiosocket(opts, pf, socktype, protocol, level)) < 0) { - return STAT_RETRYLATER; + return STAT_RETRYLATER; } applyopts_offset(xfd, opts); @@ -923,7 +923,7 @@ int _xioopen_connect(struct single *xfd, union sockaddr_union *us, size_t uslen, applies and consumes the following option: PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECT, PH_CONNECTED, PH_LATE, - OFUNC_OFFSET, + OFUNC_OFFSET, OPT_FORK, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_USER, OPT_GROUP, OPT_CLOEXEC returns 0 on success. */ @@ -1042,7 +1042,7 @@ int _xioopen_dgram_sendto(/* them is already in xfd->peersa */ #endif if ((xfd->fd = xiosocket(opts, pf, socktype, ipproto, level)) < 0) { - return STAT_RETRYLATER; + return STAT_RETRYLATER; } applyopts_offset(xfd, opts); @@ -1187,7 +1187,7 @@ void xiosigaction_hasread(int signum This function does not retry. If you need retries, handle this is a loop in the calling function. after fork, we set the forever/retry of the child process to 0 - applies and consumes the following options: + applies and consumes the following options: PH_INIT, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_EARLY, PH_PREOPEN, PH_FD, PH_CONNECTED, PH_LATE, PH_LATE2 OPT_FORK, OPT_SO_TYPE, OPT_SO_PROTOTYPE, cloexec, OPT_RANGE, tcpwrap @@ -1967,7 +1967,7 @@ int xioparsenetwork(const char *rangename, int pf, struct xiorange *range) { Error1("syntax error in \"%s\"", addrname); free(addrname); return STAT_NORETRY; } - free(addrname); + free(addrname); result = dalan(maskname, (uint8_t *)&range->netmask.soa.sa_data, &masklen, sizeof(range->netaddr)-(size_t)(&((struct sockaddr *)0)->sa_data) @@ -1998,7 +1998,7 @@ int xioparsenetwork(const char *rangename, int pf, struct xiorange *range) { } -/* parses a string of form address/bits or address:mask, and fills the fields +/* parses a string of form address/bits or address:mask, and fills the fields of the range union. The addr component is masked with mask. */ int xioparserange(const char *rangename, int pf, struct xiorange *range) { int i; @@ -2031,10 +2031,10 @@ int xioparserange(const char *rangename, int pf, struct xiorange *range) { } -/* set environment variables describing (part of) a socket address, e.g. +/* set environment variables describing (part of) a socket address, e.g. SOCAT_SOCKADDR. lr (local/remote) specifies a string like "SOCK" or "PEER". - proto should correspond to the third parameter of socket(2) and is used to - determine the presence of port information. */ + proto should correspond to the third parameter of socket(2) and is used to + determine the presence of port information. */ int xiosetsockaddrenv(const char *lr, union sockaddr_union *sau, socklen_t salen, int proto) { @@ -2064,7 +2064,7 @@ int xiosetsockaddrenv(const char *lr, xiosetenv(namebuff, valuebuff, 1, NULL); namebuff[strlen(lr)] = '\0'; ++idx; } while (result > 0); - break; + break; #endif /* WITH_IP4 */ #if WITH_IP6 case PF_INET6: @@ -2111,7 +2111,7 @@ int xiosetsockaddrenv(const char *lr, /* retrieves options so-type and so-prototype from opts, calls socket, and ev. generates an appropriate error message. returns 0 on success or -1 if an error occurred. */ -int +int xiosocket(struct opt *opts, int pf, int socktype, int proto, int msglevel) { int result; @@ -2131,7 +2131,7 @@ xiosocket(struct opt *opts, int pf, int socktype, int proto, int msglevel) { /* retrieves options so-type and so-prototype from opts, calls socketpair, and ev. generates an appropriate error message. returns 0 on success or -1 if an error occurred. */ -int +int xiosocketpair(struct opt *opts, int pf, int socktype, int proto, int sv[2]) { int result; diff --git a/xio-socket.h b/xio-socket.h index 2898ec1..1b6f00b 100644 --- a/xio-socket.h +++ b/xio-socket.h @@ -97,7 +97,7 @@ extern int _xioopen_connect(struct single *fd, bool alt, int level); /* common to xioopen_udp_sendto, ..unix_sendto, ..rawip */ -extern +extern int _xioopen_dgram_sendto(/* them is already in xfd->peersa */ union sockaddr_union *us, socklen_t uslen, struct opt *opts, @@ -115,7 +115,7 @@ int _xioopen_dgram_recv(struct single *xfd, int xioflags, int level); extern int xiodopacketinfo(struct msghdr *msgh, bool withlog, bool withenv); -extern +extern int xiogetpacketsrc(int fd, struct msghdr *msgh, int flags); extern int xiocheckpeer(xiosingle_t *xfd, @@ -126,12 +126,12 @@ int xiosetsockaddrenv(const char *lr, union sockaddr_union *sau, socklen_t salen extern int xioparsenetwork(const char *rangename, int pf, struct xiorange *range); -extern +extern int xioparserange(const char *rangename, int pf, struct xiorange *range); extern int xiosocket(struct opt *opts, int pf, int socktype, int proto, int level); -extern int +extern int xiosocketpair(struct opt *opts, int pf, int socktype, int proto, int sv[2]); #endif /* !defined(__xio_socket_h_included) */ diff --git a/xio-streams.h b/xio-streams.h index 3b71a41..89d976f 100644 --- a/xio-streams.h +++ b/xio-streams.h @@ -3,7 +3,7 @@ /* Published under the GNU General Public License V.2, see file COPYING */ /* when including this file select one part that you need by defining the - appropriate CPP define: + appropriate CPP define: (none): standard define, variable, and function declarations ENABLE_OPTCODE: option codes for use in enum e_optcode diff --git a/xio-tcpwrap.c b/xio-tcpwrap.c index a95e747..8b2fe5c 100644 --- a/xio-tcpwrap.c +++ b/xio-tcpwrap.c @@ -125,7 +125,7 @@ int xio_tcpwrap_check(xiosingle_t *xfd, union sockaddr_union *us, if (inet_ntop(us->soa.sa_family, #if WITH_IP6 us->soa.sa_family==PF_INET6 ? - (void *)&us->ip6.sin6_addr : + (void *)&us->ip6.sin6_addr : #endif (void *)&us->ip4.sin_addr, serveraddr, sizeof(serveraddr)) == NULL) { diff --git a/xio-udp.c b/xio-udp.c index 27e4f18..d2006df 100644 --- a/xio-udp.c +++ b/xio-udp.c @@ -520,7 +520,7 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts, { union sockaddr_union la; socklen_t lalen = sizeof(la); - + if (retropt_bind(opts, pf, socktype, ipproto, &la.soa, &lalen, 1, xfd->stream.para.socket.ip.res_opts[0], xfd->stream.para.socket.ip.res_opts[1]) @@ -594,7 +594,7 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts, { union sockaddr_union la; socklen_t lalen = sizeof(la); - + if (retropt_bind(opts, pf, socktype, ipproto, &xfd->stream.para.socket.la.soa, &lalen, 1, xfd->stream.para.socket.ip.res_opts[0], diff --git a/xio-unix.c b/xio-unix.c index b3a0583..683f5b5 100644 --- a/xio-unix.c +++ b/xio-unix.c @@ -17,7 +17,7 @@ /* to avoid unneccessary runtime if () conditionals when no abstract support is compiled in (or at least to give optimizing compilers a good chance) we need - a constant that can be used in C expressions */ + a constant that can be used in C expressions */ #if WITH_ABSTRACT_UNIXSOCKET # define ABSTRACT 1 #else @@ -589,7 +589,7 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i Error2("%s: wrong number of parameters (%d instead of 1)", argv[0], argc-1); } - return + return _xioopen_unix_client(&xxfd->stream, xioflags, groups, abstract, opts, argv[1]); } @@ -600,11 +600,11 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i applies and consumes the following option: PH_INIT, PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECTED, PH_LATE, ?PH_CONNECT - OFUNC_OFFSET, + OFUNC_OFFSET, OPT_PROTOCOL_FAMILY, OPT_UNIX_TIGHTSOCKLEN, OPT_UNLINK_CLOSE, OPT_BIND, - OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK, + OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK, */ -int +int _xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups, int abstract, struct opt *opts, const char *name) { const struct opt *namedopt; diff --git a/xio.h b/xio.h index de4cecc..0f89e55 100644 --- a/xio.h +++ b/xio.h @@ -132,7 +132,7 @@ struct para_ip { } ; #endif /* _WITH_IP4 || _WITH_IP6 */ -/* a non-dual file descriptor */ +/* a non-dual file descriptor */ typedef struct single { enum xiotag tag; /* see enum xiotag */ const struct addrdesc *addr; @@ -145,7 +145,7 @@ typedef struct single { #endif /* WITH_RETRY */ bool ignoreeof; /* option ignoreeof; do not pass eof condition to app*/ int eof; /* 1..exec'd child has died, but no explicit eof - occurred + occurred 2..fd0 has reached EOF, but check for ignoreeof 3..fd0 has reached EOF (definitely; never with ignoreeof! */ @@ -360,7 +360,7 @@ union integral { #if HAVE_STRUCT_LINGER struct linger u_linger; #endif /* HAVE_STRUCT_LINGER */ -#if HAVE_STRUCT_TIMESPEC +#if HAVE_STRUCT_TIMESPEC struct timespec u_timespec; #endif /* HAVE_STRUCT_TIMESPEC */ #if HAVE_STRUCT_IP_MREQ || HAVE_STRUCT_IP_MREQN diff --git a/xioclose.c b/xioclose.c index ee5473d..4c56d2a 100644 --- a/xioclose.c +++ b/xioclose.c @@ -85,7 +85,7 @@ int xioclose1(struct single *pipe) { if (pipe->havelock) { xiounlock(pipe->lock.lockfile); pipe->havelock = false; - } + } if (pipe->opt_unlink_close && pipe->unlink_close) { if (Unlink(pipe->unlink_close) < 0) { Info2("unlink(\"%s\"): %s", pipe->unlink_close, strerror(errno)); diff --git a/xioexit.c b/xioexit.c index 05b1e34..294fbe2 100644 --- a/xioexit.c +++ b/xioexit.c @@ -11,7 +11,7 @@ /* this function closes all open xio sockets on exit, if they are still open. - It must be registered with atexit(). */ + It must be registered with atexit(). */ void xioexit(void) { int i; diff --git a/xiohelp.c b/xiohelp.c index f4431ff..8d1b19f 100644 --- a/xiohelp.c +++ b/xiohelp.c @@ -59,7 +59,7 @@ static char *optionphasenames[] = { "PRESOCKET", "SOCKET", "PASTSOCKET", "PREBIGEN", "BIGEN", "PASTBIGEN", "FD", - "PREBIND", "BIND", "PASTBIND", + "PREBIND", "BIND", "PASTBIND", "PRELISTEN", "LISTEN", "PASTLISTEN", "PRECONNECT", "CONNECT", "PASTCONNECT", "PREACCEPT", "ACCEPT", "PASTACCEPT", diff --git a/xiolockfile.c b/xiolockfile.c index b2471e8..c6896d4 100644 --- a/xiolockfile.c +++ b/xiolockfile.c @@ -49,7 +49,7 @@ int xiogetlock(const char *lockfile) { Error2("mkstemp(\"%s\"): %s", s, strerror(errno)); return -1; } - + pid = Getpid(); bytes = sprintf(pidbuf, F_pid"\n", pid); if (writefull(fd, pidbuf, bytes) < 0) { diff --git a/xioopen.c b/xioopen.c index 50b449f..f879365 100644 --- a/xioopen.c +++ b/xioopen.c @@ -608,7 +608,7 @@ int xioopen_single(xiofile_t *xfd, int xioflags) { xfd->stream.flags |= (xioflags & XIO_ACCMODE); addrdesc = xfd->stream.addr; result = (*addrdesc->func)(xfd->stream.argc, xfd->stream.argv, - xfd->stream.opts, xioflags, xfd, + xfd->stream.opts, xioflags, xfd, addrdesc->groups, addrdesc->arg1, addrdesc->arg2, addrdesc->arg3); return result; diff --git a/xioopts.c b/xioopts.c index e77ff96..15a72e5 100644 --- a/xioopts.c +++ b/xioopts.c @@ -20,37 +20,37 @@ bool xioopts_ignoregroups; #if WITH_NAMED # define IF_NAMED(a,b) {a,b}, #else -# define IF_NAMED(a,b) +# define IF_NAMED(a,b) #endif #if WITH_PIPE || WITH_GOPEN # define IF_OPEN(a,b) {a,b}, #else -# define IF_OPEN(a,b) +# define IF_OPEN(a,b) #endif #if WITH_TERMIOS # define IF_TERMIOS(a,b) {a,b}, #else -# define IF_TERMIOS(a,b) +# define IF_TERMIOS(a,b) #endif #if WITH_EXEC # define IF_EXEC(a,b) {a,b}, #else -# define IF_EXEC(a,b) +# define IF_EXEC(a,b) #endif #if _WITH_SOCKET # define IF_SOCKET(a,b) {a,b}, #else -# define IF_SOCKET(a,b) +# define IF_SOCKET(a,b) #endif #if WITH_LISTEN # define IF_LISTEN(a,b) {a,b}, #else -# define IF_LISTEN(a,b) +# define IF_LISTEN(a,b) #endif #if (WITH_UDP || WITH_TCP) && WITH_LISTEN @@ -62,49 +62,49 @@ bool xioopts_ignoregroups; #if WITH_IP4 || WITH_IP6 # define IF_IP(a,b) {a,b}, #else -# define IF_IP(a,b) +# define IF_IP(a,b) #endif #if WITH_IP6 # define IF_IP6(a,b) {a,b}, #else -# define IF_IP6(a,b) +# define IF_IP6(a,b) #endif #if WITH_TCP|WITH_UDP # define IF_IPAPP(a,b) {a,b}, #else -# define IF_IPAPP(a,b) +# define IF_IPAPP(a,b) #endif #if WITH_TCP # define IF_TCP(a,b) {a,b}, #else -# define IF_TCP(a,b) +# define IF_TCP(a,b) #endif #if WITH_UDP # define IF_UDP(a,b) {a,b}, #else -# define IF_UDP(a,b) +# define IF_UDP(a,b) #endif #if WITH_SCTP # define IF_SCTP(a,b) {a,b}, #else -# define IF_SCTP(a,b) +# define IF_SCTP(a,b) #endif #if WITH_SOCKS4 # define IF_SOCKS4(a,b) {a,b}, #else -# define IF_SOCKS4(a,b) +# define IF_SOCKS4(a,b) #endif #if WITH_PROXY # define IF_PROXY(a,b) {a,b}, #else -# define IF_PROXY(a,b) +# define IF_PROXY(a,b) #endif #if WITH_READLINE @@ -140,7 +140,7 @@ bool xioopts_ignoregroups; #if WITH_RETRY # define IF_RETRY(a,b) {a,b}, #else -# define IF_RETRY(a,b) +# define IF_RETRY(a,b) #endif @@ -1003,7 +1003,7 @@ const struct optname optionnames[] = { #ifdef O_NOFOLLOW IF_OPEN ("nofollow", &opt_o_nofollow) #endif - IF_EXEC ("nofork", &opt_nofork) + IF_EXEC ("nofork", &opt_nofork) #ifdef O_NOINHERIT IF_ANY ("noinherit", &opt_o_noinherit) #endif @@ -1843,20 +1843,20 @@ const struct optname optionnames[] = { } ; -/* walks the text argument a and writes its options that conform to groups +/* walks the text argument a and writes its options that conform to groups to the array opts. Uses the option table 'optionnames'. - returns 0 on success, -1 on error, 1 on unknown/wrong option + returns 0 on success, -1 on error, 1 on unknown/wrong option */ int parseopts(const char **a, unsigned int groups, struct opt **opts) { - return parseopts_table(a, groups, opts, optionnames, + return parseopts_table(a, groups, opts, optionnames, sizeof(optionnames)/sizeof(struct optname)-1); } -/* walks the text argument a and writes its options that conform to groups +/* walks the text argument a and writes its options that conform to groups to the array opts. Uses the specified option table. - returns 0 on success, -1 on error, 1 on unknown/wrong option + returns 0 on success, -1 on error, 1 on unknown/wrong option */ int parseopts_table(const char **a, unsigned int groups, struct opt **opts, const struct optname optionnames[], size_t optionnum) { @@ -1956,7 +1956,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts, #endif } (*opts)[i].desc = ent->desc; - + if (!strncmp(*a, assign_str, strlen(assign_str))) { /* there is an assignment (mostly "=") */ (*a) += strlen(assign_str); @@ -2211,7 +2211,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts, #if LATER case TYPE_INT3: - + break; #endif @@ -2525,7 +2525,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts, *buffp++ = '\0'; (*opts)[i].value.u_ip_mreq.param2 = strdup(buff); /*!!! NULL */ -#if HAVE_STRUCT_IP_MREQN +#if HAVE_STRUCT_IP_MREQN if (*tokp++ == ':') { strncpy((*opts)[i].value.u_ip_mreq.ifindex, tokp, IF_NAMESIZE); /* ok */ Info4("setting option \"%s\" to {\"%s\",\"%s\",\"%s\"}", @@ -2605,7 +2605,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts, Error("!!!"); } //(*opts)[i].value.u_bin.b_len - } + } break; #endif /* LATER */ @@ -2758,7 +2758,7 @@ int showleft(const struct opt *opts) { /* does not set GROUP_FD; cannot determine GROUP_TERMIOS ! */ int _groupbits(mode_t mode) { unsigned int result = 0; - + switch ((mode&S_IFMT)>>12) { case (S_IFIFO>>12): /* 1, FIFO */ result = GROUP_FIFO; break; @@ -2851,8 +2851,8 @@ int retropt_timespec(struct opt *opts, int optcode, struct timespec *result) { opt->desc = ODESC_DONE; return 0; } - - + + /* Looks for the first option of type . If the option is found, this function stores its bool value in *result, "consumes" the option, and returns 0. @@ -3135,7 +3135,7 @@ int retropt_bind(struct opt *opts, != STAT_OK) { Error("error resolving bind option"); return STAT_NORETRY; - } + } break; #endif /* WITH_IP4 || WITH_IP6 */ @@ -3485,7 +3485,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { opt->desc->type); } #endif /* _WITH_SOCKET */ - + #if HAVE_FLOCK } else if (opt->desc->func == OFUNC_FLOCK) { if (Flock(fd, opt->desc->major) < 0) { @@ -3537,7 +3537,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { opt->desc = ODESC_ERROR; ++opt; continue; } #endif /* HAVE_FTRUNCATE64 */ - break; + break; case OPT_F_SETLK_RD: case OPT_F_SETLK_WR: case OPT_F_SETLKW_RD: @@ -3554,7 +3554,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { opt->desc = ODESC_ERROR; ++opt; continue; } } - break; + break; case OPT_SETUID_EARLY: case OPT_SETUID: if (Setuid(opt->value.u_uidt) < 0) { @@ -3666,7 +3666,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { } else { if (Setsid() < 0) { Error1("setsid(): %s", strerror(errno)); - } + } } } break; @@ -3807,7 +3807,7 @@ int applyopts_flags(struct opt *opts, int group, flags_t *result) { if (!opts) return 0; while (opt->desc != ODESC_END) { - if (opt->desc != ODESC_DONE && + if (opt->desc != ODESC_DONE && (opt->desc->group & group)) { if (opt->desc->func == OFUNC_FLAG) { if (opt->value.u_bool) { @@ -3984,7 +3984,7 @@ int applyopts_single(struct single *xfd, struct opt *opts, enum e_phase phase) { } xfd->havelock = true; break; - + default: /* just store the value in the correct component of struct single */ if (opt->desc->type == TYPE_CONST) { @@ -4069,7 +4069,7 @@ mc:addr if (ifindex(opt->value.u_ip_mreq.ifindex, (unsigned int *)&ip4_mreqn.mreqn.imr_ifindex, -1) < 0) { - Error1("cannot resolve interface \"%s\"", + Error1("cannot resolve interface \"%s\"", opt->value.u_ip_mreq.ifindex); } #endif /* HAVE_STRUCT_IP_MREQN */ @@ -4095,7 +4095,7 @@ mc:addr ip4_mreqn.mreq.imr_interface = sockaddr2.ip4.sin_addr; } } - + #if LATER if (0) { ; /* for canonical reasons */ diff --git a/xioopts.h b/xioopts.h index 425960f..61ced08 100644 --- a/xioopts.h +++ b/xioopts.h @@ -120,10 +120,10 @@ enum e_func { /* for simpler handling of option-to-connection-type relations we define groups. to keep the search for options simple, we allow each option to - belong to at most one group only. (we have a dummy GROUP_NONE for those + belong to at most one group only. (we have a dummy GROUP_NONE for those that don't want to belong to any...) The caller of parseopts() specifies per bitpatter a set of groups where it - accepts options from. + accepts options from. */ /*- the group bits are: diff --git a/xioparam.c b/xioparam.c index da270ea..e225a3c 100644 --- a/xioparam.c +++ b/xioparam.c @@ -47,7 +47,7 @@ int xiosetopt(char what, const char *arg) { what, arg?arg:"NULL"); return -1; } - return 0; + return 0; } @@ -64,5 +64,5 @@ int xioinqopt(char what, char *arg, size_t n) { what, arg, n); return -1; } - return 0; + return 0; } diff --git a/xioread.c b/xioread.c index b1ffd68..b05db3f 100644 --- a/xioread.c +++ b/xioread.c @@ -12,7 +12,7 @@ #include "xio-readline.h" #include "xio-openssl.h" - + /* xioread() performs read() or recvfrom() If result is < 0, errno is valid */ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) { @@ -97,7 +97,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) { case XIOREAD_READLINE: if ((bytes = xioread_readline(pipe, buff, bufsiz)) < 0) { return -1; - } + } break; #endif /* WITH_READLINE */ @@ -163,7 +163,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) { } } #endif /* defined(PF_PACKET) && defined(PACKET_OUTGOING) */ - + Notice2("received packet with "F_Zu" bytes from %s", bytes, sockaddr_info(&from.soa, fromlen, infobuff, sizeof(infobuff))); diff --git a/xioshutdown.c b/xioshutdown.c index 041d4ed..ed99e01 100644 --- a/xioshutdown.c +++ b/xioshutdown.c @@ -84,9 +84,9 @@ int xioshutdown(xiofile_t *sock, int how) { if (Close(sock->stream.para.bipipe.fdout) < 0) { Info2("close(%d): %s", sock->stream.para.bipipe.fdout, strerror(errno)); - } + } } - + } else if ((sock->stream.dtype & XIODATA_MASK) == XIODATA_2PIPE) { if ((how+1)&1) { if (Close(sock->stream.fd) < 0) { @@ -98,7 +98,7 @@ int xioshutdown(xiofile_t *sock, int how) { if (Close(sock->stream.para.exec.fdout) < 0) { Info2("close(%d): %s", sock->stream.para.exec.fdout, strerror(errno)); - } + } } #if _WITH_SOCKET } else if (sock->stream.howtoend == END_SHUTDOWN) { diff --git a/xiosignal.c b/xiosignal.c index 6982ed3..5a7b356 100644 --- a/xiosignal.c +++ b/xiosignal.c @@ -79,7 +79,7 @@ void socatsignalpass(int sig) { } -/* register the sub process pid for passing of signals of type signum. +/* register the sub process pid for passing of signals of type signum. Only for SIGHUP, SIGINT, and SIGQUIT! returns 0 on success or <0 if an error occurred */ int xio_opt_signal(pid_t pid, int signum) { diff --git a/xiowrite.c b/xiowrite.c index 7264ca6..3ce86d0 100644 --- a/xiowrite.c +++ b/xiowrite.c @@ -86,7 +86,7 @@ ssize_t xiowrite(xiofile_t *file, const void *buff, size_t bytes) { char infobuff[256]; _errno = errno; Error6("sendto(%d, %p, "F_Zu", 0, %s, "F_socklen"): %s", - pipe->fd, buff, bytes, + pipe->fd, buff, bytes, sockaddr_info(&pipe->peersa.soa, pipe->salen, infobuff, sizeof(infobuff)), pipe->salen, strerror(_errno)); @@ -96,7 +96,7 @@ ssize_t xiowrite(xiofile_t *file, const void *buff, size_t bytes) { if ((size_t)writt < bytes) { char infobuff[256]; Warn7("sendto(%d, %p, "F_Zu", 0, %s, "F_socklen") only wrote "F_Zu" of "F_Zu" bytes", - pipe->fd, buff, bytes, + pipe->fd, buff, bytes, sockaddr_info(&pipe->peersa.soa, pipe->salen, infobuff, sizeof(infobuff)), pipe->salen, writt, bytes);