Репозитории ALT
S: | 3.20.1-alt2 |
5.1: | 3.7.9-alt0.M51.1 |
4.1: | 3.6.2-alt4 |
4.0: | 3.6.2-alt4 |
3.0: | 3.6.2-alt3 |
Группа :: Работа с файлами
Пакет: logrotate
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: 0001-ALT-Improve-messages-about-wrong-file-types.patch
Скачать
Скачать
From a201fc5e3dace5534e1a9d0e1fa7cda498d9c2a8 Mon Sep 17 00:00:00 2001
From: Alexey Gladkov <legion@altlinux.org>
Date: Sat, 25 Apr 2020 17:33:19 +0300
Subject: ALT: Improve messages about wrong file types
Signed-off-by: Alexey Gladkov <legion@altlinux.org>
---
config.c | 4 ++--
logrotate.c | 13 ++++++-------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/config.c b/config.c
index dd9eb04..9d196cc 100644
--- a/config.c
+++ b/config.c
@@ -1006,8 +1006,8 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
}
if (!S_ISREG(sb_config.st_mode)) {
message(MESS_DEBUG,
- "Ignoring %s because it's not a regular file.\n",
- configFile);
+ "Ignoring %s because of unacceptable file type %#o.\n",
+ configFile, sb_config.st_mode & S_IFMT);
close(fd);
return 0;
}
diff --git a/logrotate.c b/logrotate.c
index 2350672..27a864a 100644
--- a/logrotate.c
+++ b/logrotate.c
@@ -1400,6 +1400,12 @@ static int findNeedRotating(const struct logInfo *log, unsigned logNum, int forc
return 1;
}
+ if (!S_ISREG(sb.st_mode)) {
+ message(MESS_DEBUG, " log %s has unacceptable file type %#o, skipping.\n",
+ log->files[logNum], sb.st_mode & S_IFMT);
+ return 0;
+ }
+
state = findState(log->files[logNum]);
if (!state)
return 1;
@@ -1408,13 +1414,6 @@ static int findNeedRotating(const struct logInfo *log, unsigned logNum, int forc
state->sb = sb;
state->isUsed = 1;
- if ((sb.st_mode & S_IFMT) == S_IFLNK) {
- message(MESS_DEBUG, " log %s is symbolic link. Rotation of symbolic"
- " links is not allowed to avoid security issues -- skipping.\n",
- log->files[logNum]);
- return 0;
- }
-
if (!(log->flags & LOG_FLAG_ALLOWHARDLINK) && sb.st_nlink != 1) {
message(MESS_DEBUG, " log %s has multiple (%lu) hard links. Rotation of files"
" with multiple hard links is not allowed for %s -- skipping.\n",
--
2.25.4