Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2009 18:32:53 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r194035 - stable/7/usr.bin/find
Message-ID:  <200906111832.n5BIWr5N056897@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Jun 11 18:32:53 2009
New Revision: 194035
URL: http://svn.freebsd.org/changeset/base/194035

Log:
  MFC r192381: find: do not silently disable -L when -delete is used
  
  Approved by:	jhb (mentor)

Modified:
  stable/7/usr.bin/find/   (props changed)
  stable/7/usr.bin/find/function.c

Modified: stable/7/usr.bin/find/function.c
==============================================================================
--- stable/7/usr.bin/find/function.c	Thu Jun 11 18:29:11 2009	(r194034)
+++ stable/7/usr.bin/find/function.c	Thu Jun 11 18:32:53 2009	(r194035)
@@ -427,11 +427,13 @@ f_delete(PLAN *plan __unused, FTSENT *en
 
 	/* sanity check */
 	if (isdepth == 0 ||			/* depth off */
-	    (ftsoptions & FTS_NOSTAT) ||	/* not stat()ing */
-	    !(ftsoptions & FTS_PHYSICAL) ||	/* physical off */
-	    (ftsoptions & FTS_LOGICAL))		/* or finally, logical on */
+	    (ftsoptions & FTS_NOSTAT))		/* not stat()ing */
 		errx(1, "-delete: insecure options got turned on");
 
+	if (!(ftsoptions & FTS_PHYSICAL) ||	/* physical off */
+	    (ftsoptions & FTS_LOGICAL))		/* or finally, logical on */
+		errx(1, "-delete: forbidden when symlinks are followed");
+
 	/* Potentially unsafe - do not accept relative paths whatsoever */
 	if (strchr(entry->fts_accpath, '/') != NULL)
 		errx(1, "-delete: %s: relative path potentially not safe",
@@ -462,8 +464,6 @@ c_delete(OPTION *option, char ***argvp _
 {
 
 	ftsoptions &= ~FTS_NOSTAT;	/* no optimise */
-	ftsoptions |= FTS_PHYSICAL;	/* disable -follow */
-	ftsoptions &= ~FTS_LOGICAL;	/* disable -follow */
 	isoutput = 1;			/* possible output */
 	isdepth = 1;			/* -depth implied */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906111832.n5BIWr5N056897>