bin/179122: [patch] Fix bug with newsyslog -t
Oliver Fromme
olli at secnetix.de
Thu May 30 20:40:02 UTC 2013
>Number: 179122
>Category: bin
>Synopsis: [patch] Fix bug with newsyslog -t
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu May 30 20:40:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Oliver Fromme
>Release: FreeBSD 9.1-STABLE-20130529 amd64
>Organization:
secnetix GmbH & Co. KG
>Environment:
The problem was found on stable/9 as of 2013-05-29,
but it probably also exists on head and stable/8.
>Description:
The latest commits to newsyslog.c seem to have introduced
a problem with the -t option: The wrong file name is used
with the fstatat() call when checking for the mtime.
This becomes especially apparent when thr -a option is
also used, because the file does not exist in the archive
directory, so newsyslog prints error messages. See below.
>How-To-Repeat:
Change the newsyslog entry in /etc/crontab to use both
-t and -a, for example:
0 * * * * root newsyslog -a OLD -t DEFAULT
Soon you will get output like the following mailed to you
by cron:
newsyslog: Cannot stat '/var/log/OLD/maillog': No such file or directory
newsyslog: Cannot stat '/var/log/OLD/messages': No such file or directory
>Fix:
--- usr.sbin/newsyslog/newsyslog.c.orig 2013-05-11 03:01:44.000000000 +0200
+++ usr.sbin/newsyslog/newsyslog.c 2013-05-30 15:55:19.000000000 +0200
@@ -2313,7 +2313,7 @@
if (validate_old_timelog(dp, logfname, &tm) == 0)
continue;
- if (fstatat(dir_fd, logfname, &sb, 0) == -1) {
+ if (fstatat(dir_fd, dp->d_name, &sb, 0) == -1) {
warn("Cannot stat '%s'", file);
continue;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list