← Commit list

3aae64e4fb

Viktor Szakats
Viktor Szakats
2026-08-06
SUCCESS Duration: 426s

Subject

servers: drop complex and redundant signal handler output

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

tests/server/util.c+10 -39
@@ -365,48 +365,22 @@ static HWND hidden_main_window = NULL;
*
* Only call signal-safe functions from the signal handler, as required by
* the POSIX specification:
- * https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
- * Hence, do not call 'logmsg()', and instead use 'open/write/close' to
- * log errors.
+ * https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
*/
-/* suppress warnings seen in configurations where 'write()' has the attribute
- 'warn_unused_result', which is not silenced by casting to '(void)'. */
+static void exit_signal_handler(int signum)
+{
+ int old_errno = errno;
+ static const char msg[] = "exit_signal_handler(): triggered\n";
+ /* suppress warning seen in configurations where 'write()' has the attribute
+ 'warn_unused_result', which is not silenced by casting to '(void)'. */
#if defined(CURL_HAVE_DIAG) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result" /* GCC 4.5+ */
#endif
-static void exit_signal_handler(int signum)
-{
- int old_errno = errno;
- if(!serverlogfile) {
- static const char msg[] = "exit_signal_handler: serverlogfile not set\n";
- (void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
- }
- else {
- int fd = -1;
-#ifdef _WIN32
- if(!_sopen_s(&fd, serverlogfile, _O_WRONLY | _O_CREAT | _O_APPEND,
- _SH_DENYNO, _S_IREAD | _S_IWRITE) &&
- fd != -1) {
-#else
- /* !checksrc! disable BANNEDFUNC 1 */
- fd = open(serverlogfile, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
- if(fd != -1) {
+ (void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
+#if defined(CURL_HAVE_DIAG) && !defined(__clang__)
+#pragma GCC diagnostic pop
#endif
- static const char msg[] = "exit_signal_handler: called\n";
- (void)write(fd, msg, CURL_CSTRLEN(msg));
- curlx_close(fd);
- }
- else {
- static const char msg[] = "exit_signal_handler: failed opening ";
- const char *str;
- (void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
- str = serverlogfile;
- while(*str)
- (void)write(STDERR_FILENO, str++, 1);
- (void)write(STDERR_FILENO, "\n", 1);
- }
- }
if(got_exit_signal == 0) {
got_exit_signal = 1;
exit_signal = signum;
@@ -420,9 +394,6 @@ static void exit_signal_handler(int signum)
#endif
errno = old_errno;
}
-#if defined(CURL_HAVE_DIAG) && !defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
#ifdef _WIN32
/* CTRL event handler for Windows Console applications to simulate