Thu 05 Jul 2007 11:52:22 PM UTC, original submission:
From http://article.gmane.org/gmane.comp.web.wget.general/6725/ :
On OS X, if a filename on the FTP server contains spaces, and the
remote copy of the file is newer than the local, then wget gets
thrown into a loop of "No such file or directory" endlessly. I have
changed the following in ftp-simple.c, and this fixes the error.
Sorry, I don't know how to use the proper patch formatting, but it
should be clear.
==================================
the beginning of ftp_retr:
=================================
/* Sends RETR command to the FTP server. */
uerr_t
ftp_retr (int csock, const char *file)
{
char request, respline;
int nwritten;
uerr_t err;
/* Send RETR request. */
request = ftp_request ("RETR", file);
==================================
becomes:
==================================
/* Sends RETR command to the FTP server. */
uerr_t
ftp_retr (int csock, const char *file)
{
char request, respline;
int nwritten;
uerr_t err;
char filecopy[2048];
if (file[0] != '"') {
sprintf(filecopy, "\"%.2047s\"", file);
} else {
strncpy(filecopy, file, 2047);
}
/* Send RETR request. */
request = ftp_request ("RETR", filecopy);
[Note, as Hrvoje suggests, aprintf() would be preferable to the above, which also includes a potential buffer overflow.]
|