Account for 'shit aint working' kind of issue

This commit is contained in:
flysand7 2023-06-25 02:41:07 +11:00
parent 2cad69beeb
commit 64191d2148
2 changed files with 2 additions and 1 deletions

View File

@ -275,6 +275,7 @@ FILE *freopen(const char *restrict name, const char *restrict mode, FILE *restri
DWORD share = win_mode.share;
DWORD disp = win_mode.disp;
if(name == NULL) {
// This codepath doesn't work
HANDLE handle = ReOpenFile(stream->handle, access, share, flags);
if(handle == INVALID_HANDLE_VALUE) {
return NULL;

View File

@ -647,7 +647,7 @@ int main(int argc, char **argv) {
TEST(fputs(str, file) >= 0, "fputs failed");
TEST(fputc('!', file) == '!', "fputc failed");
TEST(fflush(file) == 0, "fflush failed");
TEST(fclose(file) == 0, "fclose failed");
// TEST(fclose(file) == 0, "fclose failed");
file = freopen("test_folder/getc", "rb", file);
TEST(file != NULL, "Reopened file is NULL");
TEST(fgets(str, sizeof str, file) == str, "fgets failed");