freebsd-ports/sysutils/logrotate/files/patch-aa
Martin Wilke a4c64a0f86 - Olddir options fix
logrotate's path-type options (eg. compress, olddir,
     just to name a few) fail because FreeBSD's libc
     implements mbtrowc(3) differently, and returns -2 on
     empty string. Linux version, however, returns 0.

     A simple zero-length check added to path check function,
     which hides this.

PR:		126337
Submitted by:	Balazs NAGY <js@iksz.hu> (maintainer)
2008-08-15 19:19:35 +00:00

43 lines
1.3 KiB
Text

diff -u logrotate-3.7.7-orig/config.c logrotate-3.7.7/config.c
--- logrotate-3.7.7-orig/config.c 2008-08-07 15:10:36.000000000 +0200
+++ logrotate-3.7.7/config.c 2008-08-07 15:11:54.000000000 +0200
@@ -1,5 +1,4 @@
#include <sys/queue.h>
-#include <alloca.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -18,6 +17,7 @@
#include <wchar.h>
#include <wctype.h>
#include <fnmatch.h>
+#include <limits.h>
#include "basenames.h"
#include "log.h"
@@ -93,7 +93,7 @@
chptr = start;
- while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) {
+ while( (len = strlen(chptr)) != 0 && (len = mbrtowc(&pwc, chptr, len, NULL)) != 0 ) {
if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || iswblank(pwc) ) {
message(MESS_ERROR, "%s:%d bad %s path %s\n",
configFile, lineNum, key, start);
diff -u logrotate-3.7.7-orig/logrotate.c logrotate-3.7.7/logrotate.c
--- logrotate-3.7.7-orig/logrotate.c 2008-08-07 15:10:36.000000000 +0200
+++ logrotate-3.7.7/logrotate.c 2008-08-07 15:10:43.000000000 +0200
@@ -1,5 +1,4 @@
#include <sys/queue.h>
-#include <alloca.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -14,6 +13,7 @@
#include <unistd.h>
#include <glob.h>
#include <locale.h>
+#include <limits.h>
#ifdef WITH_SELINUX
#include <selinux/selinux.h>