This commit is contained in:
Daniel Novotny 2008-11-20 13:55:53 +00:00
parent 651cd213b6
commit 3e3b27eb33
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,71 @@
diff -up logrotate-3.7.7/config.c.curdir logrotate-3.7.7/config.c
--- logrotate-3.7.7/config.c.curdir 2008-11-20 14:50:29.000000000 +0100
+++ logrotate-3.7.7/config.c 2008-11-20 14:51:35.000000000 +0100
@@ -301,7 +301,7 @@ static void freeTailLogs(int num)
static int readConfigPath(const char *path, struct logInfo *defConfig)
{
struct stat sb;
- int here, oldnumlogs, result = 1;
+ int oldnumlogs, result = 1;
struct logInfo defConfigBackup;
if (stat(path, &sb)) {
@@ -315,17 +315,10 @@ static int readConfigPath(const char *pa
int files_count, i;
DIR *dirp;
- here = open(".", O_RDONLY);
- if (here < 0) {
- message(MESS_ERROR, "cannot open current directory: %s\n",
- strerror(errno));
- return 1;
- }
if ((dirp = opendir(path)) == NULL) {
message(MESS_ERROR, "cannot open directory %s: %s\n", path,
strerror(errno));
- close(here);
return 1;
}
files_count = 0;
@@ -344,7 +337,6 @@ static int readConfigPath(const char *pa
} else {
free_2d_array(namelist, files_count);
closedir(dirp);
- close(here);
message(MESS_ERROR, "cannot realloc: %s\n",
strerror(errno));
return 1;
@@ -358,7 +350,6 @@ static int readConfigPath(const char *pa
} else {
free_2d_array(namelist, files_count);
closedir(dirp);
- close(here);
message(MESS_ERROR, "cannot realloc: %s\n",
strerror(errno));
return 1;
@@ -370,14 +361,12 @@ static int readConfigPath(const char *pa
if (files_count > 0) {
qsort(namelist, files_count, sizeof(char *), compar);
} else {
- close(here);
return 0;
}
if (chdir(path)) {
message(MESS_ERROR, "error in chdir(\"%s\"): %s\n", path,
strerror(errno));
- close(here);
free_2d_array(namelist, files_count);
return 1;
}
@@ -399,8 +388,7 @@ static int readConfigPath(const char *pa
freeLogInfo(&defConfigBackup);
}
- fchdir(here);
- close(here);
+ chdir(".");
free_2d_array(namelist, files_count);
} else {
oldnumlogs = numLogs;

View File

@ -1,10 +1,11 @@
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.7.7
Release: 1%{?dist}
Release: 2%{?dist}
License: GPL+
Group: System Environment/Base
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
Patch1: logrotate-3.7.7-curdir.patch
Requires: coreutils >= 5.92 libsepol libselinux popt
BuildRequires: libselinux-devel popt-devel
@ -23,6 +24,7 @@ log files on your system.
%prep
%setup -q
%patch1 -p1 -b .curdir
%build
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
@ -52,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Thu Nov 20 2008 Daniel Novotny <dnovotny@redhat.com> 3.7.7-2
- fix #471463 (selinux problems with logrotate)
* Mon May 19 2008 Tomas Smetana <tsmetana@redhat.com> 3.7.7-1
- new upstream version