Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Nov 2011 03:41:34 -0600 (CST)
From:      Dan The Man <dan@sunsaturn.com>
To:        freebsd-current@freebsd.org
Subject:   Proftpd + Freebsd 9 + mod_mysql 
Message-ID:  <alpine.BSF.2.00.1111080338450.89703@sunsaturn.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]


Not sure if anyone else is having problem with proftpd on freebsd 9,
but here is a patch to stop it terminating, should be included in next 
release, courtesy of TJ saunders working with me on it.


Dan.


--
Dan The Man
CTO/ Senior System Administrator
Websites, Domains and Everything else
http://www.SunSaturn.com
Email: Dan@SunSaturn.com

[-- Attachment #2 --]
Index: src/timers.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/timers.c,v
retrieving revision 1.37
diff -u -r1.37 timers.c
--- src/timers.c	23 May 2011 21:22:24 -0000	1.37
+++ src/timers.c	5 Oct 2011 05:19:53 -0000
@@ -159,18 +159,26 @@
 }
 
 static RETSIGTYPE sig_alarm(int signo) {
+#ifdef SA_INTERRUPT
   struct sigaction act;
 
   act.sa_handler = sig_alarm;
   sigemptyset(&act.sa_mask);
-  act.sa_flags = 0;
-
-#ifdef SA_INTERRUPT
-  act.sa_flags |= SA_INTERRUPT;
-#endif
+  act.sa_flags = SA_INTERRUPT;
 
   /* Install this handler for SIGALRM. */
-  sigaction(SIGALRM, &act, NULL);
+  if (sigaction(SIGALRM, &act, NULL) < 0) {
+    pr_log_pri(PR_LOG_NOTICE,
+      "unable to install SIGALRM handler via sigaction(2): %s",
+      strerror(errno));
+  }
+#else
+  if (signal(SIGALRM, sig_alarm) == SIG_ERR) {
+    pr_log_pri(PR_LOG_NOTICE,
+      "unable to install SIGALRM handler via signal(3): %s",
+      strerror(errno));
+  }
+#endif
 
 #ifdef HAVE_SIGINTERRUPT
   siginterrupt(SIGALRM, 1);
@@ -188,17 +196,26 @@
 }
 
 static void set_sig_alarm(void) {
+#ifdef SA_INTERRUPT
   struct sigaction act;
 
   act.sa_handler = sig_alarm;
   sigemptyset(&act.sa_mask);
-  act.sa_flags = 0;
-#ifdef SA_INTERRUPT
-  act.sa_flags |= SA_INTERRUPT;
-#endif
+  act.sa_flags = SA_INTERRUPT;
 
   /* Install this handler for SIGALRM. */
-  sigaction(SIGALRM, &act, NULL);
+  if (sigaction(SIGALRM, &act, NULL) < 0) {
+    pr_log_pri(PR_LOG_NOTICE,
+      "unable to install SIGALRM handler via sigaction(2): %s",
+      strerror(errno));
+  }
+#else
+  if (signal(SIGALRM, sig_alarm) == SIG_ERR) {
+    pr_log_pri(PR_LOG_NOTICE,
+      "unable to install SIGALRM handler via signal(3): %s",
+      strerror(errno));
+  }
+#endif
 
 #ifdef HAVE_SIGINTERRUPT
   siginterrupt(SIGALRM, 1);

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1111080338450.89703>