Page MenuHomeFreeBSD

D28940.id84878.diff
No OneTemporary

D28940.id84878.diff

diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -114,7 +114,8 @@
#define CE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/
#define CE_PLAIN0 0x0800 /* Do not compress zero'th history file */
#define CE_RFC5424 0x1000 /* Use RFC5424 format rotation message */
-
+#define CE_NOEMPTY 0x2000 /* Do not rotate the file when its size */
+ /* is zero */
#define MIN_PID 5 /* Don't touch pids lower than this */
#define MAX_PID 99999 /* was lower, see /usr/include/sys/proc.h */
@@ -531,6 +532,11 @@
printf("does not exist, skipped%s.\n", temp_reason);
}
} else {
+ if (ent->flags & CE_NOEMPTY && ent->fsize == 0) {
+ if (verbose)
+ printf("--> Not rotating empty file\n");
+ return (free_or_keep);
+ }
if (ent->flags & CE_TRIMAT && !force && !rotatereq &&
!oversized) {
diffsecs = ptimeget_diff(timenow, ent->trim_at);
@@ -1291,6 +1297,9 @@
case 'd':
working->flags |= CE_NODUMP;
break;
+ case 'e':
+ working->flags |= CE_NOEMPTY;
+ break;
case 'g':
working->flags |= CE_GLOB;
break;
diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5
--- a/usr.sbin/newsyslog/newsyslog.conf.5
+++ b/usr.sbin/newsyslog/newsyslog.conf.5
@@ -21,7 +21,7 @@
.\" the suitability of this software for any purpose. It is
.\" provided "as is" without express or implied warranty.
.\"
-.Dd August 21, 2018
+.Dd February 26, 2021
.Dt NEWSYSLOG.CONF 5
.Os
.Sh NAME
@@ -286,6 +286,18 @@
This option would affect how the
.Xr dump 8
command treats the log file when making a file system backup.
+.It Cm E
+indicates that the log file should not be rotated when its
+size is zero.
+The
+.Cm E
+flag is mostly useful in conjunction with
+.Cm B
+flag to prevent
+.Xr newsyslog 8
+from inserting an informational
+.Tn ASCII
+message into the new file.
.It Cm G
indicates that the specified
.Ar logfile_name

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 4:35 PM (5 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14682150
Default Alt Text
D28940.id84878.diff (1 KB)

Event Timeline