dovecot-2.0: Solaris: Don't crash when signal handler is called ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 28 18:05:25 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/11e3058af06c
changeset: 9816:11e3058af06c
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 28 11:05:12 2009 -0400
description:
Solaris: Don't crash when signal handler is called with siginfo_t=NULL.

diffstat:

1 file changed, 16 insertions(+)
src/lib/lib-signals.c |   16 ++++++++++++++++

diffs (33 lines):

diff -r fb555af36c0f -r 11e3058af06c src/lib/lib-signals.c
--- a/src/lib/lib-signals.c	Tue Aug 25 09:31:43 2009 -0400
+++ b/src/lib/lib-signals.c	Fri Aug 28 11:05:12 2009 -0400
@@ -34,6 +34,10 @@ const char *lib_signal_code_to_str(int s
 {
 	/* common */
 	switch (sicode) {
+#ifdef SI_NOINFO
+	case SI_NOINFO:
+		return "";
+#endif
 	case SI_USER:
 		return "kill";
 #ifdef SI_KERNEL
@@ -74,6 +78,18 @@ static void sig_handler(int signo, sigin
 {
 	struct signal_handler *h;
 	char c = 0;
+
+#ifdef SI_NOINFO
+	siginfo_t tmp_si;
+
+	if (si == NULL) {
+		/* Solaris can leave this to NULL */
+		memset(&tmp_si, 0, sizeof(tmp_si));
+		tmp_si.si_signo = signo;
+		tmp_si.si_code = SI_NOINFO;
+		si = &tmp_si;
+	}
+#endif
 
 	if (signo < 0 || signo > MAX_SIGNAL_VALUE)
 		return;


More information about the dovecot-cvs mailing list