Fixed false positive seekOnAppendedFile if FILE* is reused (#6566)

This commit is contained in:
PKEuS 2015-10-13 15:31:58 +02:00
parent 05b5275110
commit 3971f8625f
2 changed files with 10 additions and 1 deletions

View File

@ -267,7 +267,8 @@ void CheckIO::checkFileUsage()
f.append_mode = Filepointer::APPEND_EX;
else
f.append_mode = Filepointer::APPEND;
}
} else
f.append_mode = Filepointer::UNKNOWN_AM;
f.mode_indent = indent;
break;
case Filepointer::POSITIONING:

View File

@ -637,6 +637,14 @@ private:
" fflush(f);\n"
"}");
ASSERT_EQUALS("", errout.str()); // #5578
check("void foo() {\n"
" FILE* f = fopen(\"\", \"a\");\n"
" fclose(f);\n"
" f = fopen(\"\", \"r\");\n"
" fseek(f, 0, SEEK_SET);\n"
"}");
ASSERT_EQUALS("", errout.str()); // #6566
}
void fflushOnInputStream() {