Skip to content

Commit c9f3ae2

Browse files
committed
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.
1 parent 5b0ff13 commit c9f3ae2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

wolfssh/port.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ extern "C" {
449449
#define WFSEEK(fs,s,o,w) fseek((s),(o),(w))
450450
#define WFTELL(fs,s) ftell((s))
451451
#define WFSTAT(fs,fd,b) fstat((fd),(b))
452-
#define WREWIND(fs,s) rewind((s))
452+
#define WREWIND(fs,s) do { fseek((s),0,SEEK_SET); \
453+
clearerr((s)); } while (0)
453454
#define WSEEK_END SEEK_END
454455
#define WBADFILE NULL
455456
#define WSETTIME(fs,f,a,m) (0)

0 commit comments

Comments
 (0)