Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2017 05:21:48 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r326763 - stable/10/usr.bin/find
Message-ID:  <201712110521.vBB5LmE8041978@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Dec 11 05:21:48 2017
New Revision: 326763
URL: https://svnweb.freebsd.org/changeset/base/326763

Log:
  MFC r325723:
  
  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

Modified:
  stable/10/usr.bin/find/function.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/find/function.c
==============================================================================
--- stable/10/usr.bin/find/function.c	Mon Dec 11 05:19:45 2017	(r326762)
+++ stable/10/usr.bin/find/function.c	Mon Dec 11 05:21:48 2017	(r326763)
@@ -896,8 +896,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?201712110521.vBB5LmE8041978>