--daemon doesn't respect --address?

Ali Polatel
2010-01-22T21:26:59Z

I've noticed a weirdness in rsync.
Let me explain it briefly with an example.
Below is a test script:

#!/bin/sh

cat >rsyncd.conf <<EOF
address = localhost
use chroot = no
hosts allow = localhost
[from]
    path = /tmp/from
    read only = yes
    comment = r/o
EOF

RSYNC_CONNECT_PROG="rsync --address=localhost --config=rsyncd.conf
--daemon" \
rsync -av --address=localhost rsync://localhost/from to

Looking at the code the daemon should bind to localhost not 0.0.0.0.
But strace shows the opposite:
alip at harikalardiyari> strace -fe bind ./test.sh
...
[pid 7279] bind(4, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
...

Is this a bug or am I misunderstanding something?

--
Regards,
Ali Polatel