X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Furl.c;h=5e2b9a3bde9f1a0d79a74bfc093317ceb3e21783;hp=87d6290ac1b032220345607de378f3e9ae2d6da9;hb=eee1589ef3d198a21635d15c9086df2b99f9013d;hpb=242ddfc74e5381dc91e2abdb5b92e985ba16458a diff --git a/src/url.c b/src/url.c index 87d6290a..5e2b9a3b 100644 --- a/src/url.c +++ b/src/url.c @@ -1617,7 +1617,26 @@ url_file_name (const struct url *u, char *replaced_filename) append_char ('\0', &temp_fnres); /* Check that the length of the file name is acceptable. */ +#ifdef WINDOWS + if (MAX_PATH > (fnres.tail + CHOMP_BUFFER + 2)) + { + max_length = MAX_PATH - (fnres.tail + CHOMP_BUFFER + 2); + /* FIXME: In Windows a filename is usually limited to 255 characters. + To really be accurate you could call GetVolumeInformation() to get + lpMaximumComponentLength + */ + if (max_length > 255) + { + max_length = 255; + } + } + else + { + max_length = 0; + } +#else max_length = get_max_length (fnres.base, fnres.tail, _PC_NAME_MAX) - CHOMP_BUFFER; +#endif if (max_length > 0 && strlen (temp_fnres.base) > max_length) { logprintf (LOG_NOTQUIET, "The name is too long, %lu chars total.\n",