Fix warning for unchecked errno in WREWIND macro

Replace rewind() with fseek(s, 0, SEEK_SET) in the WREWIND macro.
rewind() internally clears errno, which scan-build flags as
overwriting a previously unchecked errno value. fseek() to offset 0
is functionally equivalent without the implicit errno reset.
pull/943/head
John Safranek 2026-04-21 14:46:44 -07:00 committed by Paul Adelsbach
parent 1b971ffaf4
commit 97ad915726
1 changed files with 2 additions and 1 deletions

View File

@ -449,7 +449,8 @@ extern "C" {
#define WFSEEK(fs,s,o,w) fseek((s),(o),(w))
#define WFTELL(fs,s) ftell((s))
#define WFSTAT(fs,fd,b) fstat((fd),(b))
#define WREWIND(fs,s) rewind((s))
#define WREWIND(fs,s) do { fseek((s),0,SEEK_SET); \
clearerr((s)); } while (0)
#define WSEEK_END SEEK_END
#define WBADFILE NULL
#define WSETTIME(fs,f,a,m) (0)