1 Index: /trunk/logrotate.c
\r
2 ===================================================================
\r
3 --- /trunk/logrotate.c (revision 454)
\r
4 +++ /trunk/logrotate.c (revision 455)
\r
8 + int compressPipe[2];
\r
10 + int error_printed = 0;
\r
12 message(MESS_DEBUG, "compressing log with: %s\n", log->compress_prog);
\r
13 @@ -567,4 +570,12 @@
\r
16 + if (pipe(compressPipe) < 0) {
\r
17 + message(MESS_ERROR, "error opening pipe for compress: %s",
\r
24 if (!FORK_OR_VFORK()) {
\r
29 + dup2(compressPipe[1], 2);
\r
30 + close(compressPipe[0]);
\r
31 + close(compressPipe[1]);
\r
33 if (switch_user_permanently(log) != 0) {
\r
34 @@ -581,4 +595,15 @@
\r
37 + close(compressPipe[1]);
\r
38 + while ((i = read(compressPipe[0], buff, sizeof(buff) - 1)) > 0) {
\r
39 + if (!error_printed) {
\r
40 + error_printed = 1;
\r
41 + message(MESS_ERROR, "Compressing program wrote following message "
\r
42 + "to stderr when compressing log %s:\n", name);
\r
45 + fprintf(stderr, "%s", buff);
\r
47 + close(compressPipe[0]);
\r