]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix --filelist compatibility with Windows cr+lf line ending 2620/head
authorYann Collet <cyan@fb.com>
Thu, 6 May 2021 01:01:55 +0000 (18:01 -0700)
committerYann Collet <cyan@fb.com>
Thu, 6 May 2021 01:01:55 +0000 (18:01 -0700)
programs/util.c

index ffda786650937e549bc7b337fe3a8e5a7d7949c6..8d190c62c46aa19dc6f5e5149d3118be80861aeb 100644 (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--;