Branch: Tag:

2015-10-23

2015-10-23 12:33:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Mysql: Restore the SIGPIPE signal handler.

Potential fix for [bug 7582].

74:   #include "fd_control.h"   #include "mapping.h"   #include "bignum.h" + #include "signal_handler.h"   #include "module_support.h"      #ifdef HAVE_POLL_H
195:    PIKE_MYSQL->mysql = mysql_init(NULL);    if (!PIKE_MYSQL->mysql)    Pike_error ("Out of memory when initializing mysql connection.\n"); + #ifdef SIGPIPE +  /* Restore lost signal handler. +  * +  * NB: mysql_init() in MariaDB zaps the SIGPIPE handler if +  * mysql->client_flag hasn't set CLIENT_IGNORE_SIGPIPE. +  * Unfortunately, it also calls bzero(3BSD) on the struct +  * before checking the flag, so it in effect unconditionally +  * always zaps the SIGPIPE handler. +  */ +  restore_signal_handler(SIGPIPE); + #endif   }      EXIT