1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

Merge pull request #2620 from facebook/winFilelist

fix --filelist compatibility with Windows cr+lf line ending
This commit is contained in:
Yann Collet
2021-05-06 11:35:16 -07:00
committed by GitHub

View File

@ -323,9 +323,7 @@ U64 UTIL_getTotalFileSize(const char* const * fileNamesTable, unsigned nbFiles)
static size_t readLineFromFile(char* buf, size_t len, FILE* file)
{
assert(!feof(file));
/* Work around Cygwin problem when len == 1 it returns NULL. */
if (len <= 1) return 0;
CONTROL( fgets(buf, (int) len, file) );
if ( fgets(buf, (int) len, file) == NULL ) return 0;
{ size_t linelen = strlen(buf);
if (strlen(buf)==0) return 0;
if (buf[linelen-1] == '\n') linelen--;