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

Diff for /src/usr.bin/rsync/main.c between version 1.23 and 1.24

version 1.23, 2019/02/16 17:59:33 version 1.24, 2019/02/17 15:59:09
Line 284 
Line 284 
 {  {
         struct opts      opts;          struct opts      opts;
         pid_t            child;          pid_t            child;
         int              fds[2], c, st;          int              fds[2], rc = 0, c, st;
         struct fargs    *fargs;          struct fargs    *fargs;
         struct option    lopts[] = {          struct option    lopts[] = {
                 { "rsh",        required_argument, NULL,                'e' },                  { "rsh",        required_argument, NULL,                'e' },
Line 402 
Line 402 
         if (opts.server) {          if (opts.server) {
                 if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1)                  if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1)
                         err(EXIT_FAILURE, "pledge");                          err(EXIT_FAILURE, "pledge");
                 c = rsync_server(&opts, (size_t)argc, argv);                  return rsync_server(&opts, (size_t)argc, argv);
                 return c ? EXIT_SUCCESS : EXIT_FAILURE;  
         }          }
   
         /*          /*
Line 430 
Line 429 
                 if (pledge("stdio unix rpath wpath cpath dpath inet fattr chown dns getpw unveil",                  if (pledge("stdio unix rpath wpath cpath dpath inet fattr chown dns getpw unveil",
                     NULL) == -1)                      NULL) == -1)
                         err(EXIT_FAILURE, "pledge");                          err(EXIT_FAILURE, "pledge");
                 c = rsync_socket(&opts, fargs);                  rc = rsync_socket(&opts, fargs);
                 fargs_free(fargs);                  fargs_free(fargs);
                 return c ? EXIT_SUCCESS : EXIT_FAILURE;                  return rc;
         }          }
   
         /* Drop the dns/inet possibility. */          /* Drop the dns/inet possibility. */
Line 470 
Line 469 
         fds[1] = -1;          fds[1] = -1;
         if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1)          if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1)
                 err(EXIT_FAILURE, "pledge");                  err(EXIT_FAILURE, "pledge");
         c = rsync_client(&opts, fds[0], fargs);          rc = rsync_client(&opts, fds[0], fargs);
         fargs_free(fargs);          fargs_free(fargs);
   
         /*          /*
Line 479 
Line 478 
          * So close the connection here so that they don't hang.           * So close the connection here so that they don't hang.
          */           */
   
         if (!c) {          if (!rc) {
                 close(fds[0]);                  close(fds[0]);
                 fds[0] = -1;                  fds[0] = -1;
         }          }
Line 487 
Line 486 
         if (waitpid(child, &st, 0) == -1)          if (waitpid(child, &st, 0) == -1)
                 err(EXIT_FAILURE, "waitpid");                  err(EXIT_FAILURE, "waitpid");
         if (!(WIFEXITED(st) && WEXITSTATUS(st) == EXIT_SUCCESS))          if (!(WIFEXITED(st) && WEXITSTATUS(st) == EXIT_SUCCESS))
                 c = 0;                  rc = 0;
   
         if (fds[0] != -1)          if (fds[0] != -1)
                 close(fds[0]);                  close(fds[0]);
         return c ? EXIT_SUCCESS : EXIT_FAILURE;          return rc;
 usage:  usage:
         fprintf(stderr, "usage: %s [-Daglnoprtv] "          fprintf(stderr, "usage: %s [-Daglnoprtv] "
                 "[-e ssh-prog] [--delete] [--rsync-path=prog] src ... dst\n",                  "[-e ssh-prog] [--delete] [--rsync-path=prog] src ... dst\n",

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24