Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Nov 2017 19:18:47 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325723 - head/usr.bin/find
Message-ID:  <201711111918.vABJIlTj068674@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sat Nov 11 19:18:47 2017
New Revision: 325723
URL: https://svnweb.freebsd.org/changeset/base/325723

Log:
  find(1): Don't treat statfs() error as fatal in f_fstype, which can happen
  when a directory is removed in the middle of find.
  
  Instead of a full err(), allow find to continue, plus print a warning with
  exitstatus set when appropriate.
  
  Reported by:	100.chksetuid via gordon
  Reviewed by:	jilles
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D13024

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

Modified: head/usr.bin/find/function.c
==============================================================================
--- head/usr.bin/find/function.c	Sat Nov 11 18:10:09 2017	(r325722)
+++ head/usr.bin/find/function.c	Sat Nov 11 19:18:47 2017	(r325723)
@@ -902,8 +902,13 @@ f_fstype(PLAN *plan, FTSENT *entry)
 		} else
 			p = NULL;
 
-		if (statfs(entry->fts_accpath, &sb))
-			err(1, "%s", entry->fts_accpath);
+		if (statfs(entry->fts_accpath, &sb)) {
+			if (!ignore_readdir_race || errno != ENOENT) {
+				warn("statfs: %s", entry->fts_accpath);
+				exitstatus = 1;
+			}
+			return 0;
+		}
 
 		if (p) {
 			p[0] = save[0];



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