summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2020-12-15 08:20:43 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2020-12-15 08:20:43 +0000
commit9f8a9186cff36c76d5fa7dd083ab2c849acf4738 (patch)
treedfb943ff3ec6654705b3432f5b4e5d5debe83918
parent7e32411a915412c2459655b68214e1dca3e8134d (diff)
Initialize the poll_timeout before rsync_server() is called.
Without this the server will immediatly fail because the poll timeout is 0. Found and reported by Daniel Moch (daniel at danielmoch dot com)
-rw-r--r--usr.bin/rsync/main.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/rsync/main.c b/usr.bin/rsync/main.c
index 33d2e46558a..1bbbc6a9a5b 100644
--- a/usr.bin/rsync/main.c
+++ b/usr.bin/rsync/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.50 2020/11/24 16:54:44 claudio Exp $ */
+/* $Id: main.c,v 1.51 2020/12/15 08:20:42 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -409,6 +409,12 @@ main(int argc, char *argv[])
if (opts.port == NULL)
opts.port = "rsync";
+ /* by default and for --timeout=0 disable poll_timeout */
+ if (poll_timeout == 0)
+ poll_timeout = -1;
+ else
+ poll_timeout *= 1000;
+
/*
* This is what happens when we're started with the "hidden"
* --server option, which is invoked for the rsync on the remote
@@ -418,12 +424,6 @@ main(int argc, char *argv[])
if (opts.server)
exit(rsync_server(&opts, (size_t)argc, argv));
- /* by default and for --timeout=0 disable poll_timeout */
- if (poll_timeout == 0)
- poll_timeout = -1;
- else
- poll_timeout *= 1000;
-
/*
* Now we know that we're the client on the local machine
* invoking rsync(1).