Commit 2fc8d5c6 authored by Tobias Frost's avatar Tobias Frost

Import Upstream version 3.7.1

parent bc491699
logrotate
.depend
3.7 -> 3.7.1:
- Fix sending mails and running scripts after the
system() -> execve() changes
- Preserve file attributes when compressing files (original patch
by Daniel Himler)
3.6.8 -> 3.7:
- always use compressext for the extension for compressed
files; before compresscmd and compressext had to agree
......
......@@ -3,14 +3,14 @@
*/
#ifdef __hpux
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx -s"
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
#define UNCOMPRESS_COMMAND " /usr/contrib/bin/gunzip"
#define STATEFILE "/var/run/logrotate.status"
#endif
#ifdef SunOS
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx -s"
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/local/bin/gzip"
#define UNCOMPRESS_COMMAND "/usr/local/bin/gunzip"
#define STATEFILE "/var/log/logrotate.status"
......@@ -20,7 +20,7 @@
* Default settings for Linux - leave these last.
*/
#ifndef DEFAULT_MAIL_COMMAND
#define DEFAULT_MAIL_COMMAND "/bin/mail -s"
#define DEFAULT_MAIL_COMMAND "/bin/mail"
#endif
#ifndef COMPRESS_COMMAND
......
......@@ -110,7 +110,7 @@ static int runScript(char * logfn, char * script) {
close(fd);
if (!fork()) {
execlp(filespec, logfn, NULL);
execlp(filespec, filespec, logfn, NULL);
exit(1);
}
......@@ -121,7 +121,7 @@ static int runScript(char * logfn, char * script) {
return rc;
}
static int compressLogFile(char * name, logInfo * log) {
static int compressLogFile(char * name, logInfo * log, struct stat *sb) {
char * compressedName;
const char ** fullCommand;
int inFile;
......@@ -145,12 +145,33 @@ static int compressLogFile(char * name, logInfo * log) {
return 1;
}
if ((outFile = open(compressedName, O_RDWR | O_CREAT | O_TRUNC, 0666)) < 0) {
if ((outFile = open(compressedName, O_RDWR | O_CREAT | O_TRUNC, sb->st_mode)) < 0) {
message(MESS_ERROR, "unable to open %s for compressed output\n",
compressedName);
close(inFile);
return 1;
}
if (fchmod(outFile, (S_IRUSR | S_IWUSR) & sb->st_mode)) {
message(MESS_ERROR, "error setting mode of %s: %s\n",
compressedName, strerror(errno));
close(outFile);
close(inFile);
return 1;
}
if (fchown(outFile, sb->st_uid, sb->st_gid)) {
message(MESS_ERROR, "error setting owner of %s: %s\n",
compressedName, strerror(errno));
close(outFile);
close(inFile);
return 1;
}
if (fchmod(outFile, sb->st_mode)) {
message(MESS_ERROR, "error setting mode of %s: %s\n",
compressedName, strerror(errno));
close(outFile);
close(inFile);
return 1;
}
message(MESS_DEBUG, "compressing log with: %s\n", fullCommand[0]);
......@@ -517,7 +538,7 @@ int rotateSingleLog(logInfo * log, int logNum, logState * state) {
message(MESS_DEBUG, "previous log %s does not exist\n",
oldName);
} else {
hasErrors = compressLogFile(oldName, log);
hasErrors = compressLogFile(oldName, log, &sbprev);
}
}
......@@ -690,7 +711,7 @@ int rotateSingleLog(logInfo * log, int logNum, logState * state) {
if (!hasErrors &&
(log->flags & LOG_FLAG_COMPRESS) &&
!(log->flags & LOG_FLAG_DELAYCOMPRESS)) {
hasErrors = compressLogFile(finalName, log);
hasErrors = compressLogFile(finalName, log, &state->sb);
}
if (!hasErrors && log->logAddress) {
......
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
%define WITH_SELINUX 1
BuildRequires: libselinux-devel
%endif
Summary: Rotates, compresses, removes and mails system log files.
Name: logrotate
Version: 3.7
Release: 4
Version: 3.7.1
Release: 2
License: GPL
Group: System Environment/Base
Source: logrotate-%{PACKAGE_VERSION}.tar.gz
......@@ -56,6 +56,20 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) /var/lib/logrotate.status
%changelog
* Tue Oct 19 2004 Miloslav Trmac <mitr@redhat.com> - 3.7.1-2
- Fix sending mails (#131583)
- Preserve file attributes when compressing files (#121523, original patch by
Daniel Himler)
* Fri Jul 16 2004 Elliot Lee <sopwith@redhat.com> 3.7.1-1
- Fix #126490 typo
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Mon Jan 26 2004 Dan Walsh <dwalsh@redhat.com> 3.6.10-4
- fix is_selinux_enabled call
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment