Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2013 13:28:02 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246618 - head/usr.bin/find
Message-ID:  <201302101328.r1ADS2bU072611@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Feb 10 13:28:02 2013
New Revision: 246618
URL: http://svnweb.freebsd.org/changeset/base/246618

Log:
  find: In -execdir ... {} +, only pass one file per invocation.
  
  This is inefficient but ensures that -execdir ... {} + does not mix files
  from different directories in one invocation; the command could not access
  some files. Files from the same directory should really be handled in one
  invocation but this is somewhat more complicated.

Modified:
  head/usr.bin/find/function.c

Modified: head/usr.bin/find/function.c
==============================================================================
--- head/usr.bin/find/function.c	Sun Feb 10 13:20:23 2013	(r246617)
+++ head/usr.bin/find/function.c	Sun Feb 10 13:28:02 2013	(r246618)
@@ -711,7 +711,13 @@ c_exec(OPTION *option, char ***argvp)
 		for (ep = environ; *ep != NULL; ep++)
 			argmax -= strlen(*ep) + 1 + sizeof(*ep);
 		argmax -= 1 + sizeof(*ep);
-		new->e_pnummax = argmax / 16;
+		/*
+		 * Ensure that -execdir ... {} + does not mix files
+		 * from different directories in one invocation.
+		 * Files from the same directory should be handled
+		 * in one invocation but there is no code for it.
+		 */
+		new->e_pnummax = new->flags & F_EXECDIR ? 1 : argmax / 16;
 		argmax -= sizeof(char *) * new->e_pnummax;
 		if (argmax <= 0)
 			errx(1, "no space for arguments");



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