Move unsafe call out of signal handler

Cleanup clang-tidy bugprone-signal-handler findings.
- wolfsshd: drop fprintf from interruptCatch; the main accept
  loop logs "Closing down wolfSSHD" after seeing quit set.
- sftpclient: annotate wolfSSH_SFTP_Interrupt call in
  sig_handler with NOLINT, since the function is only a single
  byte store and is safe to call from a signal handler.
pull/1002/head
John Safranek 2026-06-04 13:48:31 -07:00
parent 534500d66b
commit 304955ff94
2 changed files with 4 additions and 3 deletions

View File

@ -203,8 +203,6 @@ static void ShowUsage(void)
static void interruptCatch(int in)
{
(void)in;
if (logFile)
fprintf(logFile, "Closing down wolfSSHD\n");
quit = 1;
}
@ -2762,6 +2760,9 @@ static int StartSSHD(int argc, char** argv)
}
#endif
}
if (quit && logFile) {
fprintf(logFile, "Closing down wolfSSHD\n");
}
}
#ifdef _WIN32

View File

@ -268,7 +268,7 @@ static void sig_handler(const int sig)
(void)sig;
interrupt = 1;
wolfSSH_SFTP_Interrupt(ssh);
wolfSSH_SFTP_Interrupt(ssh); /* NOLINT(bugprone-signal-handler) */
}
#endif /* WS_NO_SIGNAL */