[BACK]Return to server.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rsync

Diff for /src/usr.bin/rsync/server.c between version 1.10 and 1.11

version 1.10, 2019/03/23 16:04:28 version 1.11, 2019/05/08 20:00:25
Line 32 
Line 32 
         int      fl;          int      fl;
   
         if ((fl = fcntl(fd, F_GETFL, 0)) == -1)          if ((fl = fcntl(fd, F_GETFL, 0)) == -1)
                 ERR(sess, "fcntl: F_GETFL");                  ERR("fcntl: F_GETFL");
         else if (fcntl(fd, F_SETFL, fl|O_NONBLOCK) == -1)          else if (fcntl(fd, F_SETFL, fl|O_NONBLOCK) == -1)
                 ERR(sess, "fcntl: F_SETFL");                  ERR("fcntl: F_SETFL");
         else          else
                 return 1;                  return 1;
   
Line 66 
Line 66 
   
         if (!fcntl_nonblock(&sess, fdin) ||          if (!fcntl_nonblock(&sess, fdin) ||
              !fcntl_nonblock(&sess, fdout)) {               !fcntl_nonblock(&sess, fdout)) {
                 ERRX1(&sess, "fcntl_nonblock");                  ERRX1("fcntl_nonblock");
                 goto out;                  goto out;
         }          }
   
Line 76 
Line 76 
         sess.seed = arc4random();          sess.seed = arc4random();
   
         if (!io_read_int(&sess, fdin, &sess.rver)) {          if (!io_read_int(&sess, fdin, &sess.rver)) {
                 ERRX1(&sess, "io_read_int");                  ERRX1("io_read_int");
                 goto out;                  goto out;
         } else if (!io_write_int(&sess, fdout, sess.lver)) {          } else if (!io_write_int(&sess, fdout, sess.lver)) {
                 ERRX1(&sess, "io_write_int");                  ERRX1("io_write_int");
                 goto out;                  goto out;
         } else if (!io_write_int(&sess, fdout, sess.seed)) {          } else if (!io_write_int(&sess, fdout, sess.seed)) {
                 ERRX1(&sess, "io_write_int");                  ERRX1("io_write_int");
                 goto out;                  goto out;
         }          }
   
         sess.mplex_writes = 1;          sess.mplex_writes = 1;
   
         if (sess.rver < sess.lver) {          if (sess.rver < sess.lver) {
                 ERRX(&sess,                  ERRX("remote protocol %d is older than our own %d: unsupported",
                     "remote protocol %d is older than our own %d: unsupported",  
                     sess.rver, sess.lver);                      sess.rver, sess.lver);
                 rc = 2;                  rc = 2;
                 goto out;                  goto out;
         }          }
   
         LOG2(&sess, "server detected client version %d, server version %d, seed %d",          LOG2("server detected client version %d, server version %d, seed %d",
             sess.rver, sess.lver, sess.seed);              sess.rver, sess.lver, sess.seed);
   
         if (sess.opts->sender) {          if (sess.opts->sender) {
                 LOG2(&sess, "server starting sender");                  LOG2("server starting sender");
   
                 /*                  /*
                  * At this time, I always get a period as the first                   * At this time, I always get a period as the first
Line 111 
Line 110 
                  */                   */
   
                 if (strcmp(argv[0], ".")) {                  if (strcmp(argv[0], ".")) {
                         ERRX(&sess, "first argument must be a standalone period");                          ERRX("first argument must be a standalone period");
                         goto out;                          goto out;
                 }                  }
                 argv++;                  argv++;
                 argc--;                  argc--;
                 if (argc == 0) {                  if (argc == 0) {
                         ERRX(&sess, "must have arguments");                          ERRX("must have arguments");
                         goto out;                          goto out;
                 }                  }
   
                 if (!rsync_sender(&sess, fdin, fdout, argc, argv)) {                  if (!rsync_sender(&sess, fdin, fdout, argc, argv)) {
                         ERRX1(&sess, "rsync_sender");                          ERRX1("rsync_sender");
                         goto out;                          goto out;
                 }                  }
         } else {          } else {
                 LOG2(&sess, "server starting receiver");                  LOG2("server starting receiver");
   
                 /*                  /*
                  * I don't understand why this calling convention                   * I don't understand why this calling convention
Line 135 
Line 134 
                  */                   */
   
                 if (argc != 2) {                  if (argc != 2) {
                         ERRX(&sess, "server receiver mode requires two argument");                          ERRX("server receiver mode requires two argument");
                         goto out;                          goto out;
                 } else if (strcmp(argv[0], ".")) {                  } else if (strcmp(argv[0], ".")) {
                         ERRX(&sess, "first argument must be a standalone period");                          ERRX("first argument must be a standalone period");
                         goto out;                          goto out;
                 }                  }
   
                 if (!rsync_receiver(&sess, fdin, fdout, argv[1])) {                  if (!rsync_receiver(&sess, fdin, fdout, argv[1])) {
                         ERRX1(&sess, "rsync_receiver");                          ERRX1("rsync_receiver");
                         goto out;                          goto out;
                 }                  }
         }          }
Line 151 
Line 150 
 #if 0  #if 0
         /* Probably the EOF. */          /* Probably the EOF. */
         if (io_read_check(&sess, fdin))          if (io_read_check(&sess, fdin))
                 WARNX(&sess, "data remains in read pipe");                  WARNX("data remains in read pipe");
 #endif  #endif
   
         rc = 0;          rc = 0;

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11