diff options
author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-07-30 17:18:57 +0000 |
---|---|---|
committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-07-30 17:18:57 +0000 |
commit | 9ec7612a2f245db993be487337b1bd814ff443c1 (patch) | |
tree | 7f0b1d71cd25b85cdee3fd942da84af1f597403e /libexec | |
parent | 0feabab57605c9aa17680949ff3bdf61ed056a32 (diff) | |
download | src-9ec7612a2f245db993be487337b1bd814ff443c1.tar.gz src-9ec7612a2f245db993be487337b1bd814ff443c1.zip |
Add a comment to explain that the loop around the call to bind(2)
is not a hack, but it has a clear purpose.
Notes
Notes:
svn path=/head/; revision=132891
Diffstat (limited to 'libexec')
-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 8d44c7b8f457..87e26ce69cd4 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; |