Fixed false positive seekOnAppendedFile if FILE* is reused (#6566)
This commit is contained in:
parent
05b5275110
commit
3971f8625f
|
@ -267,7 +267,8 @@ void CheckIO::checkFileUsage()
|
||||||
f.append_mode = Filepointer::APPEND_EX;
|
f.append_mode = Filepointer::APPEND_EX;
|
||||||
else
|
else
|
||||||
f.append_mode = Filepointer::APPEND;
|
f.append_mode = Filepointer::APPEND;
|
||||||
}
|
} else
|
||||||
|
f.append_mode = Filepointer::UNKNOWN_AM;
|
||||||
f.mode_indent = indent;
|
f.mode_indent = indent;
|
||||||
break;
|
break;
|
||||||
case Filepointer::POSITIONING:
|
case Filepointer::POSITIONING:
|
||||||
|
|
|
@ -637,6 +637,14 @@ private:
|
||||||
" fflush(f);\n"
|
" fflush(f);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str()); // #5578
|
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() {
|
void fflushOnInputStream() {
|
||||||
|
|
Loading…
Reference in New Issue