mirror of
https://github.com/facebook/zstd.git
synced 2025-10-06 00:04:13 -04:00
[util] Fix readLineFromFile on Cygwin
This commit is contained in:
parent
3ed0f65158
commit
f6d00c059f
@ -278,7 +278,9 @@ U64 UTIL_getTotalFileSize(const char* const * fileNamesTable, unsigned nbFiles)
|
||||
static size_t readLineFromFile(char* buf, size_t len, FILE* file)
|
||||
{
|
||||
assert(!feof(file));
|
||||
CONTROL( fgets(buf, (int) len, file) == buf ); /* requires success */
|
||||
/* Work around Cygwin problem when len == 1 it returns NULL. */
|
||||
if (len <= 1) return 0;
|
||||
CONTROL( fgets(buf, (int) len, file) );
|
||||
{ size_t linelen = strlen(buf);
|
||||
if (strlen(buf)==0) return 0;
|
||||
if (buf[linelen-1] == '\n') linelen--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user