[packages/logrotate] - rel 2; prefix output with config name: https://fedorahosted.org/logrotate/ticket/37

arekm arekm at pld-linux.org
Wed Oct 15 14:05:19 CEST 2014


commit 4aa05ed1af9319926b55202527247b2f4fe8b062
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Oct 15 14:05:16 2014 +0200

    - rel 2; prefix output with config name: https://fedorahosted.org/logrotate/ticket/37

 logrotate-print-prog-name.patch | 50 +++++++++++++++++++++++++++++++++++++++++
 logrotate.spec                  |  6 +++--
 2 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/logrotate.spec b/logrotate.spec
index e3250e5..f212f76 100644
--- a/logrotate.spec
+++ b/logrotate.spec
@@ -20,7 +20,7 @@ Summary(tr.UTF-8):	Sistem günlüklerini yönlendirir, sıkıştırır ve mektup
 Summary(uk.UTF-8):	Ротує, компресує, видаляє та відправляє поштою лог-файли
 Name:		logrotate
 Version:	3.8.7
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Applications/System
 Source0:	https://fedorahosted.org/releases/l/o/logrotate/%{name}-%{version}.tar.gz
@@ -31,6 +31,7 @@ Source3:	%{name}.cron
 Source4:	%{name}.crontab
 Patch1:		%{name}-man.patch
 Patch2:		tabooext.patch
+Patch3:		logrotate-print-prog-name.patch
 URL:		https://fedorahosted.org/logrotate/
 %{?with_acl:BuildRequires:	acl-devel}
 %if %{with selinux}
@@ -117,11 +118,12 @@ Logrotate призначений для полегшення адміністр
 %setup -q
 %patch1 -p1
 %patch2 -p1
+%patch3 -p2
 
 %build
 %{__make} \
 	CC="%{__cc}" \
-	RPM_OPT_FLAGS="%{rpmcflags}" \
+	RPM_OPT_FLAGS="%{rpmcflags} %{rpmcppflags}" \
 	WITH_ACL=%{?with_acl:yes}%{!?with_acl:no} \
 	WITH_SELINUX=%{?with_selinux:yes}%{!?with_selinux:no} \
 	STATEFILE="%{statdir}/logrotate.status"
diff --git a/logrotate-print-prog-name.patch b/logrotate-print-prog-name.patch
new file mode 100644
index 0000000..0a2d7ca
--- /dev/null
+++ b/logrotate-print-prog-name.patch
@@ -0,0 +1,50 @@
+Index: /trunk/logrotate.c
+===================================================================
+--- /trunk/logrotate.c	(revision 454)
++++ /trunk/logrotate.c	(revision 455)
+@@ -523,4 +523,7 @@
+     int i;
+     int status;
++	int compressPipe[2];
++	char buff[4092];
++	int error_printed = 0;
+ 
+     message(MESS_DEBUG, "compressing log with: %s\n", log->compress_prog);
+@@ -567,4 +570,12 @@
+     }
+ 
++	if (pipe(compressPipe) < 0) {
++		message(MESS_ERROR, "error opening pipe for compress: %s",
++				strerror(errno));
++		close(inFile);
++		close(outFile);
++		return 1;
++	}
++
+     if (!FORK_OR_VFORK()) {
+ 	dup2(inFile, 0);
+@@ -572,4 +583,7 @@
+ 	dup2(outFile, 1);
+ 	close(outFile);
++	dup2(compressPipe[1], 2);
++	close(compressPipe[0]);
++	close(compressPipe[1]);
+ 
+ 	if (switch_user_permanently(log) != 0) {
+@@ -581,4 +595,15 @@
+     }
+ 
++    close(compressPipe[1]);
++	while ((i = read(compressPipe[0], buff, sizeof(buff) - 1)) > 0) {
++		if (!error_printed) {
++			error_printed = 1;
++			message(MESS_ERROR, "Compressing program wrote following message "
++					"to stderr when compressing log %s:\n", name);
++		}
++		buff[i] = '\0';
++		fprintf(stderr, "%s", buff);
++	}
++	close(compressPipe[0]);
+     wait(&status);
+ 
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/logrotate.git/commitdiff/4aa05ed1af9319926b55202527247b2f4fe8b062



More information about the pld-cvs-commit mailing list