tar: more-consistent EOF checking

* src/names.c (read_name_from_file): Test sign of getc return,
rather than checking exactly for EOF.  This helps the compiler
a little bit and is more consistent with other parts of this code.
This commit is contained in:
Paul Eggert
2026-08-21 11:46:59 -07:00
parent b9cdce5e2c
commit 11034474cd
+2 -2
View File
@@ -975,13 +975,13 @@ read_name_from_file (struct name_elt *ent)
}
}
if (counter == 0 && c != EOF)
if (counter == 0 && 0 <= c)
return file_list_skip;
if (counter == name_buffer_length)
name_buffer = xpalloc (name_buffer, &name_buffer_length, 1, -1, 1);
name_buffer[counter] = 0;
return (counter == 0 && c == EOF) ? file_list_end : file_list_success;
return (counter == 0 && c < 0) ? file_list_end : file_list_success;
}
static bool