=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/main.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- src/usr.bin/rsync/main.c 2019/05/28 18:20:30 1.46 +++ src/usr.bin/rsync/main.c 2019/06/03 15:37:48 1.47 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.46 2019/05/28 18:20:30 deraadt Exp $ */ +/* $Id: main.c,v 1.47 2019/06/03 15:37:48 naddy Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -428,8 +428,10 @@ if (fargs->remote && opts.ssh_prog == NULL) { assert(fargs->mode == FARGS_RECEIVER); - if ((rc = rsync_connect(&opts, &sd, fargs)) == 0) + if ((rc = rsync_connect(&opts, &sd, fargs)) == 0) { rc = rsync_socket(&opts, sd, fargs); + close(sd); + } exit(rc); } @@ -484,14 +486,7 @@ break; } - /* - * If the client has an error and exits, the server may be - * sitting around waiting to get data while we waitpid(). - * So close the connection here so that they don't hang. - */ - - if (rc) - close(fds[0]); + close(fds[0]); if (waitpid(child, &st, 0) == -1) err(1, "waitpid");