commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. rel-2_1-89-gce10588


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-89-gce10588
Date: Wed, 02 Jun 2010 19:11:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=ce10588ad7e5f4656874d884ff3cedf4ef89165d

The branch, master has been updated
       via  ce10588ad7e5f4656874d884ff3cedf4ef89165d (commit)
       via  c4a0a717bdc8f9e1e1fb8fa4caf0910e784e8698 (commit)
       via  4f14a906311f8f650a12c8a697bc57a37f2096fa (commit)
      from  7cbbb4012d63c86e8e0726a5634bdd880ffe34b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ce10588ad7e5f4656874d884ff3cedf4ef89165d
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Jun 2 22:08:18 2010 +0300

    Minor fix.
    
    * examples/Makefile.am (mta_CPPFLAGS): New variable.

commit c4a0a717bdc8f9e1e1fb8fa4caf0910e784e8698
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Jun 2 22:06:58 2010 +0300

    Implement mu-mailbox-get-size function.
    
    * libmu_scm/mu_mailbox.c (mu-mailbox-get-size): New function.

commit 4f14a906311f8f650a12c8a697bc57a37f2096fa
Author: Sergey Poznyakoff <address@hidden>
Date:   Sun May 2 22:34:54 2010 +0300

    Fix mailbox corruption in imap4d.
    
    Delivery of a signal when a previous signal was being handled caused
    mailbox corruption.
    
    * imap4d/imap4d.c (imap4d_child_signal_setup): New function.
    (imap4d_mainloop): Call imap4d_child_signal_setup.
    * imap4d/signal.c (imap4d_child_signal): Reset all signal handlers
    before doing actual job.
    * lib/signal.c (mu_set_signals): Use sigaction.

-----------------------------------------------------------------------

Summary of changes:
 examples/Makefile.am   |    1 +
 imap4d/imap4d.c        |   14 +++++++++-----
 imap4d/signal.c        |   18 +++++++++++-------
 lib/signal.c           |   11 ++++++++++-
 libmu_scm/mu_mailbox.c |   20 ++++++++++++++++++++
 5 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/examples/Makefile.am b/examples/Makefile.am
index 1e189a1..cb2415b 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -78,6 +78,7 @@ msg_send_LDADD =\
  @address@hidden
  ${MU_LIB_MAILUTILS}
 
+mta_CPPFLAGS=-I${top_srcdir}/lib -I${top_builddir}/lib
 mta_LDADD =\
  ../lib/libmuaux.la\
  ${MU_LIB_MBOX}\
diff --git a/imap4d/imap4d.c b/imap4d/imap4d.c
index 195c4af..0b36a00 100644
--- a/imap4d/imap4d.c
+++ b/imap4d/imap4d.c
@@ -383,18 +383,22 @@ get_client_address (int fd, struct sockaddr_in *pcs)
   return 0;
 }
 
+void
+imap4d_child_signal_setup (RETSIGTYPE (*handler) (int signo))
+{
+  static int sigtab[] = { SIGILL, SIGBUS, SIGFPE, SIGSEGV, SIGSTOP, SIGPIPE,
+                         SIGABRT, SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGALRM };
+  mu_set_signals (handler, sigtab, MU_ARRAY_SIZE (sigtab));
+}
+
 static int
 imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
 {
   imap4d_tokbuf_t tokp;
   char *text;
   int debug_mode = isatty (fd);
-  static int sigtab[] = { SIGILL, SIGBUS, SIGFPE, SIGSEGV, SIGSTOP, SIGPIPE,
-                         SIGABRT, SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGALRM };
 
-  /* Reset signals */
-  mu_set_signals (imap4d_child_signal, sigtab, MU_ARRAY_SIZE (sigtab));
-  
+  imap4d_child_signal_setup (imap4d_child_signal);
   util_setio (infile, outfile);
 
   if (imap4d_preauth_setup (fd) == 0)
diff --git a/imap4d/signal.c b/imap4d/signal.c
index c9dcfc5..d71138e 100644
--- a/imap4d/signal.c
+++ b/imap4d/signal.c
@@ -49,21 +49,25 @@ imap4d_master_signal (int signo)
 RETSIGTYPE
 imap4d_child_signal (int signo)
 {
+  imap4d_child_signal_setup (SIG_IGN);
   mu_diag_output (MU_DIAG_CRIT, _("got signal `%s'"), strsignal (signo));
-
   switch (signo)
     {
     case SIGTERM:
     case SIGHUP:
-      imap4d_bye (ERR_TERMINATE);
-
+      signo = ERR_TERMINATE;
+      break;
+      
     case SIGALRM:
-      imap4d_bye (ERR_TIMEOUT);
-
+      signo = ERR_TIMEOUT;
+      break;
+      
     case SIGPIPE:
-      imap4d_bye (ERR_NO_OFILE);
+      signo = ERR_NO_OFILE;
+      break;
       
     default:
-      imap4d_bye (ERR_SIGNAL);
+      signo = ERR_SIGNAL;
     }
+  imap4d_bye (signo);
 }
diff --git a/lib/signal.c b/lib/signal.c
index 8f5b615..8ce2108 100644
--- a/lib/signal.c
+++ b/lib/signal.c
@@ -26,7 +26,16 @@ void
 mu_set_signals (RETSIGTYPE (*handler) (int signo), int *sigv, int sigc)
 {
   int i;
+  struct sigaction act;
 
+  act.sa_flags = 0;
+  sigemptyset (&act.sa_mask);
   for (i = 0; i < sigc; i++)
-    signal (sigv[i], handler);
+    sigaddset (&act.sa_mask, i);
+      
+  for (i = 0; i < sigc; i++)
+    {
+      act.sa_handler = handler;
+      sigaction (sigv[i], &act, NULL);
+    }
 }
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index dce05e8..90ee4da 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -523,6 +523,26 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, 
"mu-mailbox-more-messages?",
 }
 #undef FUNC_NAME
 
+SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_size, "mu-mailbox-get-size", 1, 0, 0,
+                  (SCM mbox),
+                  "Return size of the mailbox @var{mbox}.")
+#define FUNC_NAME s_scm_mu_mailbox_get_size
+{
+  struct mu_mailbox *mum;
+  int status;
+  mu_off_t size;
+  
+  SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+  mum = (struct mu_mailbox *) SCM_CDR (mbox);
+  status = mu_mailbox_get_size (mum->mbox, &size);
+  if (status)
+    mu_scm_error (FUNC_NAME, status,
+                 "~A: cannot determine mailbox size: ~A",
+                 scm_list_2 (mbox,
+                             scm_from_locale_string (mu_strerror (status))));
+  return scm_from_uintmax (size);
+}
+
 /* Initialize the module */
 void
 mu_scm_mailbox_init ()


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]