I have an older bsd system I cannot currently upgrade that doesnt have strerror_r() so I've
modified the sterror_r #ifdef in configure and the milter to deal with it a bit more platform
agnostic..


here is the patch.

Phil.
Index: configure.in
===================================================================
RCS file: /cvsroot/clamav/clamav-devel/configure.in,v
retrieving revision 1.26
diff -u -r1.26 configure.in
--- configure.in        29 Feb 2004 17:29:09 -0000      1.26
+++ configure.in        3 Mar 2004 21:06:33 -0000
@@ -79,7 +79,7 @@
 [  --disable-clamuko     Disable clamuko support (Linux and FreeBSD only)],
 want_clamuko="no",)
 
-AC_CHECK_FUNCS(setsid memcpy snprintf)
+AC_CHECK_FUNCS(setsid memcpy snprintf strerror_r)
 AC_FUNC_SETPGRP
 
 have_milter="no"
Index: clamav-config.h.in
===================================================================
RCS file: /cvsroot/clamav/clamav-devel/clamav-config.h.in,v
retrieving revision 1.3
diff -u -r1.3 clamav-config.h.in
--- clamav-config.h.in  23 Feb 2004 17:24:52 -0000      1.3
+++ clamav-config.h.in  3 Mar 2004 21:06:33 -0000
@@ -120,6 +120,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
 /* Define to 1 if you have the <sys/inttypes.h> header file. */
 #undef HAVE_SYS_INTTYPES_H
 
Index: clamav-milter/clamav-milter.c
===================================================================
RCS file: /cvsroot/clamav/clamav-devel/clamav-milter/clamav-milter.c,v
retrieving revision 1.58
diff -u -r1.58 clamav-milter.c
--- clamav-milter/clamav-milter.c       3 Mar 2004 09:14:55 -0000       1.58
+++ clamav-milter/clamav-milter.c       3 Mar 2004 21:06:33 -0000
@@ -1752,11 +1752,11 @@
 
                        /* 0.4 - use better error message */
                        if(use_syslog) {
-#ifdef TARGET_OS_SOLARIS       /* no strerror_r */
-                               syslog(LOG_ERR, "Failed to connect to port %d given by 
clamd: %s", port, strerror(rc));
-#else
+#ifdef HAVE_STRERROR_R
                                strerror_r(rc, buf, sizeof(buf));
                                syslog(LOG_ERR, "Failed to connect to port %d given by 
clamd: %s", port, buf);
+#else
+                               syslog(LOG_ERR, "Failed to connect to port %d given by 
clamd: %s", port, strerror(rc));
 #endif
                        }
 

Reply via email to