changeset 1087:c1f6c20cde9a HEAD

We don't need to raise SIGHUP in alarm handler, that was just a mistake in first tests. That also means gdb won't break at SIGALRM and I can remove the DISABLE_ALARMHUP kludge.
author Timo Sirainen <tss@iki.fi>
date Mon, 03 Feb 2003 07:01:05 +0200
parents 067130d609b7
children eedb1467ccb0
files src/imap/main.c src/lib/alarm-hup.c src/pop3/main.c
diffstat 3 files changed, 1 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/main.c	Sun Feb 02 12:59:58 2003 +0200
+++ b/src/imap/main.c	Mon Feb 03 07:01:05 2003 +0200
@@ -125,8 +125,6 @@
 #ifdef DEBUG
 	if (getenv("LOGGED_IN") != NULL)
 		fd_debug_verify_leaks(3, 1024);
-	else
-		putenv("DISABLE_ALARMHUP=1"); /* annoying when debugging */
 #endif
 	/* NOTE: we start rooted, so keep the code minimal until
 	   restrict_access_by_env() is called */
--- a/src/lib/alarm-hup.c	Sun Feb 02 12:59:58 2003 +0200
+++ b/src/lib/alarm-hup.c	Mon Feb 03 07:01:05 2003 +0200
@@ -37,9 +37,6 @@
 {
 	unsigned int old;
 
-	if (getenv("DISABLE_ALARMHUP") != NULL)
-		return 0;
-
 	old = alarm_timeout;
 	alarm_timeout = timeout;
 
@@ -49,32 +46,18 @@
 
 static void sig_alarm(int signo __attr_unused__)
 {
-	/* we need syscalls to stop with EINTR */
-	if (raise(SIGHUP) < 0)
-		i_fatal("kill(): %m");
-
 	/* do it again */
 	alarm(alarm_timeout);
-
-#ifndef HAVE_SIGACTION
-	signal(SIGALRM, sig_alarm);
-#endif
 }
 
 void alarm_hup_init(void)
 {
-#ifdef HAVE_SIGACTION
 	struct sigaction act;
-#endif
-
-	if (getenv("DISABLE_ALARMHUP") != NULL)
-		alarm_timeout = 0;
 
 	if (initialized)
 		return;
 	initialized = TRUE;
 
-#ifdef HAVE_SIGACTION
 	if (sigemptyset(&act.sa_mask) < 0)
 		i_fatal("sigemptyset(): %m");
 	act.sa_flags = 0;
@@ -84,23 +67,13 @@
 		if (errno != EINTR)
 			i_fatal("sigaction(): %m");
 	}
-#else
-	/* at least Linux blocks raise(SIGHUP) inside SIGALRM
-	   handler if it's added with signal().. sigaction() should
-	   be pretty much everywhere though, so this code is pretty
-	   useless. */
-#warning timeouting may not work
-	signal(SIGALRM, sig_alarm);
-#endif
 
 	alarm(alarm_timeout);
 }
 
 void alarm_hup_deinit(void)
 {
-#ifdef HAVE_SIGACTION
 	struct sigaction act;
-#endif
 
 	if (!initialized)
 		return;
@@ -108,7 +81,6 @@
 
 	alarm(0);
 
-#ifdef HAVE_SIGACTION
 	if (sigemptyset(&act.sa_mask) < 0)
 		i_fatal("sigemptyset(): %m");
 	act.sa_flags = 0;
@@ -117,7 +89,4 @@
 		if (errno != EINTR)
 			i_fatal("sigaction(): %m");
 	}
-#else
-	signal(SIGALRM, SIG_DFL);
-#endif
 }
--- a/src/pop3/main.c	Sun Feb 02 12:59:58 2003 +0200
+++ b/src/pop3/main.c	Mon Feb 03 07:01:05 2003 +0200
@@ -117,10 +117,8 @@
 int main(int argc __attr_unused__, char *argv[], char *envp[])
 {
 #ifdef DEBUG
-	if (getenv("LOGGED_IN") != NULL) {
+	if (getenv("LOGGED_IN") != NULL)
 		fd_debug_verify_leaks(3, 1024);
-		putenv("DISABLE_ALARMHUP=1"); /* annoying when debugging */
-	}
 #endif
 	/* NOTE: we start rooted, so keep the code minimal until
 	   restrict_access_by_env() is called */