From 97ad915726f6545b8f2c9b6ace12e4b761ac468c Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 21 Apr 2026 14:46:44 -0700 Subject: [PATCH] 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. --- wolfssh/port.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolfssh/port.h b/wolfssh/port.h index 5e9571f9..c7886290 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -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)