737b02cf38
Resolves: RHEL-5711
105 lines
3.5 KiB
Diff
105 lines
3.5 KiB
Diff
From a272346b75de27b5c87ea60901ccd790c823ec52 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Fri, 18 Dec 2020 15:09:35 +0100
|
|
Subject: [PATCH 1/3] Ensure the type for configuration flags is wide enough
|
|
|
|
On 32-bit platforms int might be only 16 bit wide. With the next added
|
|
flag this size will be exceeded.
|
|
|
|
(cherry picked from commit dcb05f64bf1d397e3fff8b4b2a2418a177bb9377)
|
|
---
|
|
configure.ac | 2 ++
|
|
logrotate.c | 2 +-
|
|
logrotate.h | 35 ++++++++++++++++++-----------------
|
|
3 files changed, 21 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 5229db0..9ffcb22 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -18,6 +18,8 @@ AC_STRUCT_ST_BLOCKS
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
+AC_TYPE_UINT32_T
|
|
+
|
|
dnl Use 64-bit file offsets on 32-bit systems (defines C macros if necessary)
|
|
AC_SYS_LARGEFILE
|
|
|
|
diff --git a/logrotate.c b/logrotate.c
|
|
index 43ff9ef..819aaed 100644
|
|
--- a/logrotate.c
|
|
+++ b/logrotate.c
|
|
@@ -1155,7 +1155,7 @@ static int sparse_copy(int src_fd, int dest_fd, const struct stat *sb,
|
|
}
|
|
|
|
static int copyTruncate(const char *currLog, const char *saveLog, const struct stat *sb,
|
|
- int flags, int skip_copy)
|
|
+ uint32_t flags, int skip_copy)
|
|
{
|
|
int rc = 1;
|
|
int fdcurr = -1, fdsave = -1;
|
|
diff --git a/logrotate.h b/logrotate.h
|
|
index 25b5851..0a086ae 100644
|
|
--- a/logrotate.h
|
|
+++ b/logrotate.h
|
|
@@ -1,6 +1,7 @@
|
|
#ifndef H_LOGROTATE
|
|
#define H_LOGROTATE
|
|
|
|
+#include <stdint.h>
|
|
#include <sys/types.h>
|
|
#include "queue.h"
|
|
#include <glob.h>
|
|
@@ -10,22 +11,22 @@
|
|
# include <libgen.h>
|
|
#endif
|
|
|
|
-#define LOG_FLAG_COMPRESS (1 << 0)
|
|
-#define LOG_FLAG_CREATE (1 << 1)
|
|
-#define LOG_FLAG_IFEMPTY (1 << 2)
|
|
-#define LOG_FLAG_DELAYCOMPRESS (1 << 3)
|
|
-#define LOG_FLAG_COPYTRUNCATE (1 << 4)
|
|
-#define LOG_FLAG_MISSINGOK (1 << 5)
|
|
-#define LOG_FLAG_MAILFIRST (1 << 6)
|
|
-#define LOG_FLAG_SHAREDSCRIPTS (1 << 7)
|
|
-#define LOG_FLAG_COPY (1 << 8)
|
|
-#define LOG_FLAG_DATEEXT (1 << 9)
|
|
-#define LOG_FLAG_SHRED (1 << 10)
|
|
-#define LOG_FLAG_SU (1 << 11)
|
|
-#define LOG_FLAG_DATEYESTERDAY (1 << 12)
|
|
-#define LOG_FLAG_OLDDIRCREATE (1 << 13)
|
|
-#define LOG_FLAG_TMPFILENAME (1 << 14)
|
|
-#define LOG_FLAG_DATEHOURAGO (1 << 15)
|
|
+#define LOG_FLAG_COMPRESS (1U << 0)
|
|
+#define LOG_FLAG_CREATE (1U << 1)
|
|
+#define LOG_FLAG_IFEMPTY (1U << 2)
|
|
+#define LOG_FLAG_DELAYCOMPRESS (1U << 3)
|
|
+#define LOG_FLAG_COPYTRUNCATE (1U << 4)
|
|
+#define LOG_FLAG_MISSINGOK (1U << 5)
|
|
+#define LOG_FLAG_MAILFIRST (1U << 6)
|
|
+#define LOG_FLAG_SHAREDSCRIPTS (1U << 7)
|
|
+#define LOG_FLAG_COPY (1U << 8)
|
|
+#define LOG_FLAG_DATEEXT (1U << 9)
|
|
+#define LOG_FLAG_SHRED (1U << 10)
|
|
+#define LOG_FLAG_SU (1U << 11)
|
|
+#define LOG_FLAG_DATEYESTERDAY (1U << 12)
|
|
+#define LOG_FLAG_OLDDIRCREATE (1U << 13)
|
|
+#define LOG_FLAG_TMPFILENAME (1U << 14)
|
|
+#define LOG_FLAG_DATEHOURAGO (1U << 15)
|
|
|
|
#define NO_MODE ((mode_t) -1)
|
|
#define NO_UID ((uid_t) -1)
|
|
@@ -70,7 +71,7 @@ struct logInfo {
|
|
char *uncompress_prog;
|
|
char *compress_ext;
|
|
char *dateformat; /* specify format for strftime (for dateext) */
|
|
- int flags;
|
|
+ uint32_t flags;
|
|
int shred_cycles; /* if !=0, pass -n shred_cycles to GNU shred */
|
|
mode_t createMode; /* if any/all of these are -1, we use the */
|
|
uid_t createUid; /* attributes from the log file just rotated */
|
|
--
|
|
2.47.1
|
|
|