Date: Thu, 30 May 2013 22:34:00 +0200 (CEST) From: Oliver Fromme <olli@secnetix.de> To: FreeBSD-gnats-submit@freebsd.org Cc: Oliver Fromme <olli@secnetix.de> Subject: bin/179122: [patch] Fix bug with newsyslog -t Message-ID: <201305302034.r4UKY0Sk028154@grabthar.secnetix.de> Resent-Message-ID: <201305302040.r4UKe2jU051196@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305302034.r4UKY0Sk028154>