Browse code

strerror_r is confused on Linux

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@422 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/03/20 21:31:27
Showing 3 changed files
... ...
@@ -1,3 +1,11 @@
1
+Sat Mar 20 12:40:15 GMT 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter: strerror_r is a bit confused on Fedora Linux. The man page
4
+	says it returns an int, but the prototype in string.h says it returns
5
+	a char *
6
+		Say how many bytes can't be written to clamd - it may give a
7
+	clue what's wrong
8
+
1 9
 Sat Mar 20 00:16:26 CET 2004 (tk)
2 10
 ---------------------------------
3 11
   * libclamav: cl_gentemp(): do not use /dev/urandom
... ...
@@ -285,6 +285,11 @@ Changes
285 285
 0.67l	10/3/04	Use new HAVE_STRERROR_R rather than TARGET_OS_SOLARIS to
286 286
 		determine if strerror_r exists
287 287
 0.70	17/3/04	Up-issued to 0.70
288
+0.70a	20/3/04	strerror_r is a bit confused on Fedora Linux. The
289
+		man page says it returns an int, but the prototype
290
+		in string.h says it returns a char *
291
+		Say how many bytes can't be written to clamd - it may give a
292
+		clue what's wrong
288 293
 
289 294
 BUG REPORTS
290 295
 
... ...
@@ -284,9 +284,17 @@
284 284
  *	0.67l	10/3/04	Use new HAVE_STRERROR_R rather than TARGET_OS_SOLARIS
285 285
  *			to determine if strerror_r exists
286 286
  *	0.70	17/3/04	Up-issued to 0.70
287
+ *	0.70a	20/3/04	strerror_r is a bit confused on Fedora Linux. The
288
+ *			man page says it returns an int, but the prototype
289
+ *			in string.h says it returns a char *
290
+ *			Say how many bytes can't be written to clamd - it may
291
+ *			give a clue what's wrong
287 292
  *
288 293
  * Change History:
289 294
  * $Log: clamav-milter.c,v $
295
+ * Revision 1.63  2004/03/20 12:30:00  nigelhorne
296
+ * strerror_r is confused on Linux
297
+ *
290 298
  * Revision 1.62  2004/03/17 19:46:49  nigelhorne
291 299
  * Upissue to 0.70@
292 300
  *
... ...
@@ -458,9 +466,9 @@
458 458
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
459 459
  * Added -f flag use MaxThreads if --max-children not set
460 460
  */
461
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.62 2004/03/17 19:46:49 nigelhorne Exp $";
461
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.63 2004/03/20 12:30:00 nigelhorne Exp $";
462 462
 
463
-#define	CM_VERSION	"0.70"
463
+#define	CM_VERSION	"0.70a"
464 464
 
465 465
 /*#define	CONFDIR	"/usr/local/etc"*/
466 466
 
... ...
@@ -1770,10 +1778,10 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
1770 1770
 			/* 0.4 - use better error message */
1771 1771
 			if(use_syslog) {
1772 1772
 #ifdef HAVE_STRERROR_R
1773
+				strerror_r(rc, buf, sizeof(buf));
1773 1774
                                 syslog(LOG_ERR,
1774 1775
 					"Failed to connect to port %d given by clamd: %s",
1775
-					port,
1776
-					strerror_r(rc, buf, sizeof(buf)));
1776
+					port, buf);
1777 1777
 #else
1778 1778
                                syslog(LOG_ERR, "Failed to connect to port %d given by clamd: %s", port, strerror(rc));
1779 1779
 #endif
... ...
@@ -2404,7 +2412,7 @@ clamfi_send(const struct privdata *privdata, size_t len, const char *format, ...
2404 2404
 			perror("send");
2405 2405
 			checkClamd();
2406 2406
 			if(use_syslog)
2407
-				syslog(LOG_ERR, "write failure to clamd");
2407
+				syslog(LOG_ERR, "write failure (%u bytes) to clamd", len);
2408 2408
 
2409 2409
 			return -1;
2410 2410
 		}