I've made two little patches to allow dovecot to be compiled on GNU/Hurd.

Could you review them?

Kind regards,
Marco Nenciarini

-- 
---------------------------------------------------------------------
|    Marco Nenciarini    | Debian/GNU Linux Developer - Plug Member |
| mnen...@prato.linux.it | http://www.prato.linux.it/~mnencia       |
---------------------------------------------------------------------
Key fingerprint = FED9 69C7 9E67 21F5 7D95  5270 6864 730D F095 E5E4

# HG changeset patch
# User Marco Nenciarini <mnen...@prato.linux.it>
# Date 1260984874 -3600
# Branch HEAD
# Node ID b7276a3006d847d39cd5b39ac2197a47191181e5
# Parent  9c99f15829faf182d2e4c343994a004e85cbd2c2
Fix build on HURD (PATH_MAX not defined)

diff --git a/src/lib/compat.h b/src/lib/compat.h
--- a/src/lib/compat.h
+++ b/src/lib/compat.h
@@ -254,3 +254,10 @@
 	((errno) == EEXIST || (errno) == ENOTEMPTY || (errno) == EBUSY)
 
 #endif
+
+/* PATH_MAX is only defined if the system actually have such fixed limit */
+/* see http://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html */
+/* and http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html */
+#ifndef PATH_MAX
+#  define PATH_MAX 1024
+#endif
# HG changeset patch
# User Marco Nenciarini <mnen...@prato.linux.it>
# Date 1260984992 -3600
# Branch HEAD
# Node ID cf920078addcd4a9b163b25796cb00bbfc67bd26
# Parent  b7276a3006d847d39cd5b39ac2197a47191181e5
Fix build on HURD (SA_SIGINFO not available)

diff --git a/src/lib/ioloop-notify-dn.c b/src/lib/ioloop-notify-dn.c
--- a/src/lib/ioloop-notify-dn.c
+++ b/src/lib/ioloop-notify-dn.c
@@ -191,9 +191,15 @@
 		/* SIGIO is sent if queue gets full. we'll just ignore it. */
 		signal(SIGIO, SIG_IGN);
 
+#ifdef SA_SIGINFO
 		act.sa_sigaction = sigrt_handler;
 		sigemptyset(&act.sa_mask);
 		act.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
+#else
+		act.sa_handler = sigrt_handler;
+		sigemptyset(&act.sa_mask);
+		act.sa_flags = SA_RESTART | SA_NODEFER;
+#endif
 
 		if (sigaction(SIGRTMIN, &act, NULL) < 0) {
 			if (errno == EINVAL) {
diff --git a/src/lib/lib-signals.c b/src/lib/lib-signals.c
--- a/src/lib/lib-signals.c
+++ b/src/lib/lib-signals.c
@@ -75,12 +75,17 @@
 	return t_strdup_printf("unknown %d", sicode);
 }
 
+#ifdef SA_SIGINFO
 static void sig_handler(int signo, siginfo_t *si, void *context ATTR_UNUSED)
+#else
+static void sig_handler(int signo)
+#endif
 {
 	struct signal_handler *h;
 	char c = 0;
 
-#ifdef SI_NOINFO
+#ifdef SA_SIGINFO
+#  ifdef SI_NOINFO
 	siginfo_t tmp_si;
 
 	if (si == NULL) {
@@ -90,6 +95,14 @@
 		tmp_si.si_code = SI_NOINFO;
 		si = &tmp_si;
 	}
+#  endif
+#else
+	siginfo_t *si;
+	siginfo_t tmp_si;
+
+	memset(&tmp_si, 0, sizeof(tmp_si));
+	tmp_si.si_signo = signo;
+	si = &tmp_si;
 #endif
 
 	if (signo < 0 || signo > MAX_SIGNAL_VALUE)
@@ -115,8 +128,12 @@
 	}
 }
 
+#ifdef SA_SIGINFO
 static void sig_ignore(int signo ATTR_UNUSED, siginfo_t *si ATTR_UNUSED,
 		       void *context ATTR_UNUSED)
+#else
+static void sig_ignore(int signo ATTR_UNUSED)
+#endif
 {
 	/* if we used SIG_IGN instead of this function,
 	   the system call might be restarted */
@@ -173,8 +190,13 @@
 
 	if (sigemptyset(&act.sa_mask) < 0)
 		i_fatal("sigemptyset(): %m");
+#ifdef SA_SIGINFO
 	act.sa_flags = SA_SIGINFO;
 	act.sa_sigaction = ignore ? sig_ignore : sig_handler;
+#else
+	act.sa_flags = 0;
+	act.sa_handler = ignore ? sig_ignore : sig_handler;
+#endif
 	if (sigaction(signo, &act, NULL) < 0)
 		i_fatal("sigaction(%d): %m", signo);
 }
@@ -235,8 +257,13 @@
 		act.sa_flags = SA_RESTART;
 		act.sa_handler = SIG_IGN;
 	} else {
+#ifdef SA_SIGINFO
 		act.sa_flags = SA_SIGINFO;
 		act.sa_sigaction = sig_ignore;
+#else
+		act.sa_flags = 0;
+		act.sa_handler = sig_ignore;
+#endif
 	}
 
 	if (sigaction(signo, &act, NULL) < 0)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to