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

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


details:   http://hg.dovecot.org/dovecot-1.2/rev/cc4af8e31175
changeset: 9340:cc4af8e31175
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 28 11:04:53 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 355d5a40f7a7 -r cc4af8e31175 src/lib/lib-signals.c
--- a/src/lib/lib-signals.c	Tue Aug 25 09:30:11 2009 -0400
+++ b/src/lib/lib-signals.c	Fri Aug 28 11:04:53 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