diff options
author | yar <yar@FreeBSD.org> | 2004-07-30 17:18:57 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2004-07-30 17:18:57 +0000 |
commit | 883988043400c9f44deb3cfba74345e361b61515 (patch) | |
tree | 7f0b1d71cd25b85cdee3fd942da84af1f597403e /libexec/ftpd | |
parent | 24912a0c07678c94fd76f096fc5ff24a19323273 (diff) | |
download | FreeBSD-src-883988043400c9f44deb3cfba74345e361b61515.zip FreeBSD-src-883988043400c9f44deb3cfba74345e361b61515.tar.gz |
Add a comment to explain that the loop around the call to bind(2)
is not a hack, but it has a clear purpose.
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/ftpd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 8d44c7b..87e26ce 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1821,6 +1821,15 @@ getdatasock(char *mode) data_source.su_port = htons(dataport); (void) seteuid((uid_t)0); for (tries = 1; ; tries++) { + /* + * We should loop here since it's possible that + * another ftpd instance has passed this point and is + * trying to open a data connection in active mode now. + * Until the other connection is opened, we'll be getting + * EADDRINUSE because no SOCK_STREAM sockets in the system + * can share both local and remote addresses, localIP:20 + * and *:* in this case. + */ if (bind(s, (struct sockaddr *)&data_source, data_source.su_len) >= 0) break; |