From owner-svn-src-all@FreeBSD.ORG Wed May 29 22:29:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BFCB4A88; Wed, 29 May 2013 22:29:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A0AD3CCA; Wed, 29 May 2013 22:29:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4TMTXrA079439; Wed, 29 May 2013 22:29:33 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4TMTXTO079438; Wed, 29 May 2013 22:29:33 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201305292229.r4TMTXTO079438@svn.freebsd.org> From: Mark Johnston Date: Wed, 29 May 2013 22:29:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251112 - stable/8/usr.sbin/newsyslog X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 22:29:33 -0000 Author: markj Date: Wed May 29 22:29:33 2013 New Revision: 251112 URL: http://svnweb.freebsd.org/changeset/base/251112 Log: Revert my previous merge. There's a variable name difference between head and stable (dirfd vs. dir_fd) and I managed to get it wrong again when I did the MFC, even after I tested. Modified: stable/8/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/8/usr.sbin/newsyslog/ (props changed) Modified: stable/8/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.c Wed May 29 21:08:23 2013 (r251111) +++ stable/8/usr.sbin/newsyslog/newsyslog.c Wed May 29 22:29:33 2013 (r251112) @@ -1447,27 +1447,16 @@ oldlog_entry_compare(const void *a, cons * tm if this is the case; otherwise return false. */ static int -validate_old_timelog(int fd, const struct dirent *dp, const char *logfname, - struct tm *tm) +validate_old_timelog(const struct dirent *dp, const char *logfname, struct tm *tm) { - struct stat sb; size_t logfname_len; char *s; int c; logfname_len = strlen(logfname); - if (dp->d_type != DT_REG) { - /* - * Some filesystems (e.g. NFS) don't fill out the d_type field - * and leave it set to DT_UNKNOWN; in this case we must obtain - * the file type ourselves. - */ - if (dp->d_type != DT_UNKNOWN || - fstatat(fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) != 0 || - !S_ISREG(sb.st_mode)) - return (0); - } + if (dp->d_type != DT_REG) + return (0); /* Ignore everything but files with our logfile prefix. */ if (strncmp(dp->d_name, logfname, logfname_len) != 0) return (0); @@ -1519,7 +1508,7 @@ static void delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir) { char *logfname, *s, *dir, errbuf[80]; - int dir_fd, i, logcnt, max_logcnt; + int dirfd, i, logcnt, max_logcnt; struct oldlog_entry *oldlogs; struct dirent *dp; const char *cdir; @@ -1551,9 +1540,9 @@ delete_oldest_timelog(const struct conf_ /* First we create a 'list' of all archived logfiles */ if ((dirp = opendir(dir)) == NULL) err(1, "Cannot open log directory '%s'", dir); - dir_fd = dirfd(dirp); + dirfd = dirfd(dirp); while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) + if (validate_old_timelog(dp, logfname, &tm) == 0) continue; /* @@ -2259,7 +2248,7 @@ mtime_old_timelog(const char *file) { struct stat sb; struct tm tm; - int dirfd; + int dir_fd; time_t t; struct dirent *dp; DIR *dirp; @@ -2284,13 +2273,13 @@ mtime_old_timelog(const char *file) warn("Cannot open log directory '%s'", dir); return (t); } - dirfd = dirfd(dirp); + dir_fd = dirfd(dirp); /* Open the archive dir and find the most recent archive of logfname. */ while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) + if (validate_old_timelog(dp, logfname, &tm) == 0) continue; - if (fstatat(dir_fd, logfname, &sb, AT_SYMLINK_NOFOLLOW) == -1) { + if (fstatat(dir_fd, logfname, &sb, 0) == -1) { warn("Cannot stat '%s'", file); continue; }