svn commit: r308158 - head/usr.sbin/cron/cron

Baptiste Daroussin bapt at FreeBSD.org
Mon Oct 31 23:40:05 UTC 2016


Author: bapt
Date: Mon Oct 31 23:40:04 2016
New Revision: 308158
URL: https://svnweb.freebsd.org/changeset/base/308158

Log:
  Allow symlinks to be followed in cron.d directories and fix detection of
  regular files on NFS
  
  Reported by:	jilles

Modified:
  head/usr.sbin/cron/cron/database.c

Modified: head/usr.sbin/cron/cron/database.c
==============================================================================
--- head/usr.sbin/cron/cron/database.c	Mon Oct 31 23:32:38 2016	(r308157)
+++ head/usr.sbin/cron/cron/database.c	Mon Oct 31 23:40:04 2016	(r308158)
@@ -44,7 +44,7 @@ load_database(old_db)
 {
 	DIR		*dir;
 	struct stat	statbuf;
-	struct stat	syscron_stat;
+	struct stat	syscron_stat, st;
 	time_t		maxmtime;
 	DIR_T   	*dp;
 	cron_db		new_db;
@@ -124,7 +124,8 @@ load_database(old_db)
 		while (NULL != (dp = readdir(dir))) {
 			if (dp->d_name[0] == '.')
 				continue;
-			if (dp->d_type != DT_REG)
+			if (fstatat(dirfd(dir), dp->d_name, &st, 0) == 0 &&
+			    !S_ISREG(st.st_mode))
 				continue;
 			snprintf(tabname, sizeof(tabname), "%s/%s",
 			    syscrontabs[i].name, dp->d_name);


More information about the svn-src-head mailing list