bug-mailutils
[Top][All Lists]
Advanced

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

sys_siglist compatibility.


From: Sergey Poznyakoff
Subject: sys_siglist compatibility.
Date: Mon, 21 May 2001 17:30:29 +0300

Hi,

Here are some observations:
1. sys_siglist[], referenced in imap4d/signal.c might not be defined on
some systems.
2. strtok_r.c contains an inconsistency in return statement.

The following fixes the situation:

ChangeLog:
        * configure.in, imap4d/signal.c, pop3d/signal.c:
          sys_siglist is not defined on some systems (namely, Solaris).
        * lib/signame.c: (added) Provide mu_signame() function to convert
          signal number to string representation.
        * lib/strtok_r.c: bugfix

Patch:

Index: configure.in
===================================================================
RCS file: /cvs/mailutils/configure.in,v
retrieving revision 1.44
diff -p -u -r1.44 configure.in
--- configure.in        2001/05/02 04:45:11     1.44
+++ configure.in        2001/05/21 14:12:44
@@ -67,6 +67,7 @@ AC_TYPE_OFF_T
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL
+AC_DECL_SYS_SIGLIST
 
 dnl Check for working functions
 
Index: imap4d/signal.c
===================================================================
RCS file: /cvs/mailutils/imap4d/signal.c,v
retrieving revision 1.1
diff -p -u -r1.1 signal.c
--- imap4d/signal.c     2001/05/09 04:30:23     1.1
+++ imap4d/signal.c     2001/05/21 14:12:47
@@ -39,9 +39,9 @@ imap4d_sigchld (int signo)
 RETSIGTYPE
 imap4d_signal (int signo)
 {
-  extern const char *const sys_siglist[];
-  /* syslog (LOG_CRIT, "got signal %d", signo); */
-  syslog (LOG_CRIT, "got signal %s", sys_siglist[signo]);
+  extern char *mu_signame __P((int signo));
+
+  syslog (LOG_CRIT, "got signal %s", mu_signame(signo));
   /* Master process.  */
   if (!ofile)
     {
Index: lib/Makefile.am
===================================================================
RCS file: /cvs/mailutils/lib/Makefile.am,v
retrieving revision 1.15
diff -p -u -r1.15 Makefile.am
--- lib/Makefile.am     2001/05/02 04:45:11     1.15
+++ lib/Makefile.am     2001/05/21 14:12:47
@@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = ansi2knr
 noinst_LIBRARIES = libmailutils.a
 
 libmailutils_a_SOURCES = basename.c getopt.c getopt1.c md5.c getline.c \
-  xstrdup.c xmalloc.c argcv.c
+  xstrdup.c xmalloc.c argcv.c signame.c
 
 EXTRA_DIST = alloca.c fnmatch.c setenv.c snprintf.c strchrnul.c strndup.c \
   strnlen.c strtok_r.c xstrtol.c vasprintf.c
Index: lib/strtok_r.c
===================================================================
RCS file: /cvs/mailutils/lib/strtok_r.c,v
retrieving revision 1.3
diff -p -u -r1.3 strtok_r.c
--- lib/strtok_r.c      2001/02/26 03:15:03     1.3
+++ lib/strtok_r.c      2001/05/21 14:12:47
@@ -54,7 +54,7 @@ strtok_r (s, delim, save_ptr)
   if (s == NULL)
     /* This token finishes the string.  */
     /* *save_ptr = __rawmemchr (token, '\0'); */
-    *save_ptr = s + strlen (token);
+    *save_ptr = token + strlen (token);
   else
     {
       /* Terminate the token and make *SAVE_PTR point past it.  */
       syslog (LOG_INFO, "Session ended for user: %s", username);
Index: pop3d/signal.c
===================================================================
RCS file: /cvs/mailutils/pop3d/signal.c,v
retrieving revision 1.7
diff -p -u -r1.7 signal.c
--- pop3d/signal.c      2001/05/09 04:23:52     1.7
+++ pop3d/signal.c      2001/05/21 14:12:54
@@ -38,7 +38,9 @@ pop3d_sigchld (int signo)
 RETSIGTYPE
 pop3d_signal (int signo)
 {
-  syslog (LOG_CRIT, "got signal %d", signo);
+  extern char *mu_signame __P((int signo));
+  
+  syslog (LOG_CRIT, "got signal %s", mu_signame(signo));
   /* Master process.  */
   if (!ofile)
     {


The lib/signame.c is supposed to contain the following:

#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <signal.h>
#include <unistd.h>

char *
mu_signame(int signo)
{
#ifdef SYS_SIGLIST_DECLARED
  return sys_siglist[signo];
#else
  static char buf[64];
  snprintf(buf, sizeof(buf), "%d", signo);
  return buf;
#endif  
}


Cheers,
Sergey



reply via email to

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