History log of /openbsd-current/usr.bin/rsync/sender.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.33 20-Mar-2024 claudio

Remove some else statements in if () else if () chains that don't need
to be written this way. Makes the code more readable.
OK tb@


Revision tags: OPENBSD_7_5_BASE
# 1.32 27-Feb-2024 claudio

Split hash_file into three steps, setup, add buf and final.

Setup inits the context and adds the seed. The buf function simply adds
a block from the file to the hash. The final function calls MD4_Final()
to close the context and generate the hash.

This will help to remove the mmap in the sender and should result in a
more atomic view of the file since hash_file() is now called together
with the other hash_functions.

OK deraadt@ tb@


# 1.31 19-Feb-2024 claudio

Fix a deadlock in openrsync when big files are synced using the hash
algorithm. Make sure the sender does not run ahead of itself and end
stalling in a read from network that never shows up. Instead ensure
that all queued data is pushed out before accepting new data.

Problem found by and fix developed with Kyle Evans (kevans freebsd.org)
OK tb@ deraadt@


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.30 29-Aug-2021 claudio

Implement --exclude/exclude-file and --include/include-file.
Currently only simple include and excludes work, the advanced filters
introduced later in rsync are not implemented. It is unclear if the per
directory filters are something we want to implement. This requires
more modern protocols which openrsync is not able to handle right now.

This adds a special matching function to allow the ** matching which behaves
mostly like rsyncs version with the exception of how bad [] patterns are
expanded. For bad patterns openrsync follows more how fnmatch behaves and
not the somewhat strange rsync behaviour.

Not perfect but committing now so people can test and provide feedback.


# 1.29 30-Jun-2021 claudio

Replace Id: tags with OpenBSD: tags
OK deraadt@


Revision tags: OPENBSD_6_9_BASE
# 1.28 05-Apr-2021 deraadt

branches: 1.28.2;
minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.32 27-Feb-2024 claudio

Split hash_file into three steps, setup, add buf and final.

Setup inits the context and adds the seed. The buf function simply adds
a block from the file to the hash. The final function calls MD4_Final()
to close the context and generate the hash.

This will help to remove the mmap in the sender and should result in a
more atomic view of the file since hash_file() is now called together
with the other hash_functions.

OK deraadt@ tb@


# 1.31 19-Feb-2024 claudio

Fix a deadlock in openrsync when big files are synced using the hash
algorithm. Make sure the sender does not run ahead of itself and end
stalling in a read from network that never shows up. Instead ensure
that all queued data is pushed out before accepting new data.

Problem found by and fix developed with Kyle Evans (kevans freebsd.org)
OK tb@ deraadt@


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.30 29-Aug-2021 claudio

Implement --exclude/exclude-file and --include/include-file.
Currently only simple include and excludes work, the advanced filters
introduced later in rsync are not implemented. It is unclear if the per
directory filters are something we want to implement. This requires
more modern protocols which openrsync is not able to handle right now.

This adds a special matching function to allow the ** matching which behaves
mostly like rsyncs version with the exception of how bad [] patterns are
expanded. For bad patterns openrsync follows more how fnmatch behaves and
not the somewhat strange rsync behaviour.

Not perfect but committing now so people can test and provide feedback.


# 1.29 30-Jun-2021 claudio

Replace Id: tags with OpenBSD: tags
OK deraadt@


Revision tags: OPENBSD_6_9_BASE
# 1.28 05-Apr-2021 deraadt

branches: 1.28.2;
minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.31 19-Feb-2024 claudio

Fix a deadlock in openrsync when big files are synced using the hash
algorithm. Make sure the sender does not run ahead of itself and end
stalling in a read from network that never shows up. Instead ensure
that all queued data is pushed out before accepting new data.

Problem found by and fix developed with Kyle Evans (kevans freebsd.org)
OK tb@ deraadt@


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.30 29-Aug-2021 claudio

Implement --exclude/exclude-file and --include/include-file.
Currently only simple include and excludes work, the advanced filters
introduced later in rsync are not implemented. It is unclear if the per
directory filters are something we want to implement. This requires
more modern protocols which openrsync is not able to handle right now.

This adds a special matching function to allow the ** matching which behaves
mostly like rsyncs version with the exception of how bad [] patterns are
expanded. For bad patterns openrsync follows more how fnmatch behaves and
not the somewhat strange rsync behaviour.

Not perfect but committing now so people can test and provide feedback.


# 1.29 30-Jun-2021 claudio

Replace Id: tags with OpenBSD: tags
OK deraadt@


Revision tags: OPENBSD_6_9_BASE
# 1.28 05-Apr-2021 deraadt

branches: 1.28.2;
minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.30 29-Aug-2021 claudio

Implement --exclude/exclude-file and --include/include-file.
Currently only simple include and excludes work, the advanced filters
introduced later in rsync are not implemented. It is unclear if the per
directory filters are something we want to implement. This requires
more modern protocols which openrsync is not able to handle right now.

This adds a special matching function to allow the ** matching which behaves
mostly like rsyncs version with the exception of how bad [] patterns are
expanded. For bad patterns openrsync follows more how fnmatch behaves and
not the somewhat strange rsync behaviour.

Not perfect but committing now so people can test and provide feedback.


# 1.29 30-Jun-2021 claudio

Replace Id: tags with OpenBSD: tags
OK deraadt@


Revision tags: OPENBSD_6_9_BASE
# 1.28 05-Apr-2021 deraadt

minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.29 30-Jun-2021 claudio

Replace Id: tags with OpenBSD: tags
OK deraadt@


Revision tags: OPENBSD_6_9_BASE
# 1.28 05-Apr-2021 deraadt

minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.28 05-Apr-2021 deraadt

minor KNF


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.27 22-Mar-2021 claudio

Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.26 24-Nov-2020 claudio

Simple implementation of --timeout to exit after specified seconds of I/O
inactivity. By default rsync will wait forever but this results in stuck
processes if the remote side does not answer properly as seen in rpki-client.
OK job@ benno@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.25 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.24 02-Jun-2019 florian

Use a simple hash table to look up blocks by the fast-hash. Also use
a rolling computation for the fast-hash.OB With this openrsync is on
par with gpl rsync for file updates.
From kristaps


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.23 08-May-2019 benno

remove sess argument from all functions that only used it for logging
functions.
ok deraadt@


# 1.22 08-May-2019 benno

remove sess argument from log functions. ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.21 02-Apr-2019 deraadt

annoying white space


# 1.20 23-Mar-2019 deraadt

indents and reflows around ERR*() and LOG*(); ok benno


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.19 21-Feb-2019 benno

kristaps 156cf3b7d459efe133d603158fc33c243dc07ba0
Use style(9) for bit


# 1.18 21-Feb-2019 benno

kristaps 97df28257f3cc5faae8072fbadbc334a57a4e8a7
Remove another potential deadlock when in sender mode with
multiplexing enabled.


# 1.17 21-Feb-2019 benno

kristaps b1c688cad9f544a59b871c9984888cb1a3ae11e4
Avoid crash when -n is specified.


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.16 18-Feb-2019 benno

new attempt to sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.15 18-Feb-2019 benno

revert previous


# 1.14 18-Feb-2019 benno

sync with kristaps up to Sun Feb 17 2019

339cf5998c0c022623cd68de50722b6c14543952 Push "error trail" further into code.

baf58ce5fe1bc6ce431b3b0ac8264b83ae8c7d02 Document all arguments. Add
common -av usage. Remove bits about not supporting anything but
files/dirs.

821a811a8c80e52fb56b241fc65a16cae1b4fb2c Disambiguate as prodded by deraadt@

6c4475b8f226e9031ec0ec1b3f14f7d347132c87 Add -h to usage string

4d344ae6156873b44c95de0c1ed629e637c2d7ab Clarify error message
language, use service name instead of port, specify that the socket is
SOCK_STREAM. From deraadt@. Tweaked for lowercase messages.

f3ec049e76257fc96bcdc872f1d3b967b98f3eb6 In consideration to benno@'s
comments, let the mktemp functions propogate an errno handled by the
caller. Also keep the original line lengths. While in mktemp.c, make
some defines into an enum.

e116c2bd00e634b56e4276120135915ceaa31cf2 Put the FSM of the sender
into its own function. Put dry_run ack and end of phase ack into the
send buffer too, further reducing the possibility of deadlock.

c7745aa4c7394ca89d841f8ee76782256d694340 Make the sender write loop be
fully non-blocking. This frees us of deadlocking the protocol because
the sender will always be able to pull down data.

93c7b4843e80aeac2ec6ae6ffc395df4deaf4a31 Remove "yoda" notation to be
more in tune with OpenBSD. Most found by deraadt@.


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.13 17-Feb-2019 deraadt

more yoda repairs


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.12 16-Feb-2019 deraadt

use MINIMUM() instead of MIN() as elsewhere in the tree


# 1.11 16-Feb-2019 deraadt

nasty ugly invisible spaces


# 1.10 16-Feb-2019 florian

sync with kristaps, commit 42166a639caa877efd91e73e288b89abf6b7cfd3
Remove spaces at end of line.


# 1.9 16-Feb-2019 florian

sync with kristaps, commit 1842d31d600f2834ae78fe0d99a29519a853d75c
Make sender mostly nonblocking for writes. This takes a lot of logic once
in blocks.c and puts it directly into sender.c. It allows running openrsync
against itself without deadlocks.


# 1.8 16-Feb-2019 florian

sync with kristaps, commit f5c1e234990877cd274b7bcdd4d9883104cd1568
Make sender have reentrant sending and prioritised reading. This way,
the sender gets data off the wire as quickly as possible. While here,
remove dead wood from blocks.c (blk_merge).


# 1.7 16-Feb-2019 deraadt

unwrap lines which do not need wrapping


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@


# 1.6 12-Feb-2019 benno

sync, this also adds the -g option to the option parser.

commit c7818bfb17195fcd7b723889bb8652b9ea024b01
Author: kristaps <>
Date: Mon Feb 11 23:26:55 2019 +0000

Add getpw pledge for -g work.


# 1.5 11-Feb-2019 deraadt

swap comparison arguments as needed, to match idiomatic C most of us
are familiar with. Proofed by florian and benno


# 1.4 11-Feb-2019 deraadt

cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno


# 1.3 10-Feb-2019 benno

canonical order of pledge()s.
stop at 80 char line lenght.


# 1.2 10-Feb-2019 benno

fix whitespace


# 1.1 10-Feb-2019 benno

Import Kristaps' openrsync into the tree.
OK deraadt@