Diff for /embedaddon/rsync/socket.c between versions 1.1 and 1.1.1.3

version 1.1, 2012/02/17 15:09:30 version 1.1.1.3, 2016/11/01 09:54:32
Line 3 Line 3
  *   *
  * Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>   * Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>
  * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>   * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
 * Copyright (C) 2003-2009 Wayne Davison * Copyright (C) 2003-2015 Wayne Davison
  *   *
  * This program is free software; you can redistribute it and/or modify   * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
Line 25 Line 25
  * emulate it using the KAME implementation. */   * emulate it using the KAME implementation. */
   
 #include "rsync.h"  #include "rsync.h"
#include "ifuncs.h"#include "itypes.h"
 #ifdef HAVE_NETINET_IN_SYSTM_H  #ifdef HAVE_NETINET_IN_SYSTM_H
 #include <netinet/in_systm.h>  #include <netinet/in_systm.h>
 #endif  #endif
Line 161  int try_bind_local(int s, int ai_family, int ai_sockty Line 161  int try_bind_local(int s, int ai_family, int ai_sockty
 }  }
   
 /* connect() timeout handler based on alarm() */  /* connect() timeout handler based on alarm() */
static RETSIGTYPE contimeout_handler(UNUSED(int val))static void contimeout_handler(UNUSED(int val))
 {  {
         connect_timeout = -1;          connect_timeout = -1;
 }  }
Line 229  int open_socket_out(char *host, int port, const char * Line 229  int open_socket_out(char *host, int port, const char *
                 }                  }
                 *cp++ = '\0';                  *cp++ = '\0';
                 strlcpy(portbuf, cp, sizeof portbuf);                  strlcpy(portbuf, cp, sizeof portbuf);
                if (verbose >= 2) {                if (DEBUG_GTE(CONNECT, 1)) {
                         rprintf(FINFO, "connection via http proxy %s port %s\n",                          rprintf(FINFO, "connection via http proxy %s port %s\n",
                                 h, portbuf);                                  h, portbuf);
                 }                  }
Line 301  int open_socket_out(char *host, int port, const char * Line 301  int open_socket_out(char *host, int port, const char *
                         s = -1;                          s = -1;
                         continue;                          continue;
                 }                  }
                if (verbose >= 3) {                if (DEBUG_GTE(CONNECT, 2)) {
                         char buf[2048];                          char buf[2048];
                         if ((error = getnameinfo(res->ai_addr, res->ai_addrlen, buf, sizeof buf, NULL, 0, NI_NUMERICHOST)) != 0)                          if ((error = getnameinfo(res->ai_addr, res->ai_addrlen, buf, sizeof buf, NULL, 0, NI_NUMERICHOST)) != 0)
                                 snprintf(buf, sizeof buf, "*getnameinfo failure: %s*", gai_strerror(error));                                  snprintf(buf, sizeof buf, "*getnameinfo failure: %s*", gai_strerror(error));
Line 310  int open_socket_out(char *host, int port, const char * Line 310  int open_socket_out(char *host, int port, const char *
                 break;                  break;
         }          }
   
        if (s < 0 || verbose >= 3) {        if (s < 0 || DEBUG_GTE(CONNECT, 2)) {
                 char buf[2048];                  char buf[2048];
                 for (res = res0, j = 0; res; res = res->ai_next, j++) {                  for (res = res0, j = 0; res; res = res->ai_next, j++) {
                         if (errnos[j] == 0)                          if (errnos[j] == 0)
Line 381  int open_socket_out_wrapped(char *host, int port, cons Line 381  int open_socket_out_wrapped(char *host, int port, cons
                 *t = '\0';                  *t = '\0';
         }          }
   
        if (verbose >= 2) {        if (DEBUG_GTE(CONNECT, 1)) {
                 rprintf(FINFO, "%sopening tcp connection to %s port %d\n",                  rprintf(FINFO, "%sopening tcp connection to %s port %d\n",
                         prog ? "Using RSYNC_CONNECT_PROG instead of " : "",                          prog ? "Using RSYNC_CONNECT_PROG instead of " : "",
                         host, port);                          host, port);
Line 489  static int *open_socket_in(int type, int port, const c Line 489  static int *open_socket_in(int type, int port, const c
         /* Only output the socket()/bind() messages if we were totally          /* Only output the socket()/bind() messages if we were totally
          * unsuccessful, or if the daemon is being run with -vv. */           * unsuccessful, or if the daemon is being run with -vv. */
         for (s = 0; s < ecnt; s++) {          for (s = 0; s < ecnt; s++) {
                if (!i || verbose > 1)                if (!i || DEBUG_GTE(BIND, 1))
                         rwrite(FLOG, errmsgs[s], strlen(errmsgs[s]), 0);                          rwrite(FLOG, errmsgs[s], strlen(errmsgs[s]), 0);
                 free(errmsgs[s]);                  free(errmsgs[s]);
         }          }
Line 529  int is_a_socket(int fd) Line 529  int is_a_socket(int fd)
 }  }
   
   
static RETSIGTYPE sigchld_handler(UNUSED(int val))static void sigchld_handler(UNUSED(int val))
 {  {
 #ifdef WNOHANG  #ifdef WNOHANG
         while (waitpid(-1, NULL, WNOHANG) > 0) {}          while (waitpid(-1, NULL, WNOHANG) > 0) {}
Line 557  void start_accept_loop(int port, int (*fn)(int, int)) Line 557  void start_accept_loop(int port, int (*fn)(int, int))
         /* ready to listen */          /* ready to listen */
         FD_ZERO(&deffds);          FD_ZERO(&deffds);
         for (i = 0, maxfd = -1; sp[i] >= 0; i++) {          for (i = 0, maxfd = -1; sp[i] >= 0; i++) {
                if (listen(sp[i], 5) < 0) {                if (listen(sp[i], lp_listen_backlog()) < 0) {
                         rsyserr(FERROR, errno, "listen() on socket failed");                          rsyserr(FERROR, errno, "listen() on socket failed");
 #ifdef INET6  #ifdef INET6
                         if (errno == EADDRINUSE && i > 0) {                          if (errno == EADDRINUSE && i > 0) {
Line 831  static int sock_exec(const char *prog) Line 831  static int sock_exec(const char *prog)
                 rsyserr(FERROR, errno, "socketpair_tcp failed");                  rsyserr(FERROR, errno, "socketpair_tcp failed");
                 return -1;                  return -1;
         }          }
        if (verbose >= 2)        if (DEBUG_GTE(CMD, 1))
                 rprintf(FINFO, "Running socket program: \"%s\"\n", prog);                  rprintf(FINFO, "Running socket program: \"%s\"\n", prog);
   
         pid = fork();          pid = fork();

Removed from v.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>