osutil: handle deletion race with readdir/stat (issue3463) stable
authorMatt Mackall <mpm@selenic.com>
Fri, 18 May 2012 14:34:33 -0500
branchstable
changeset 16747 6476a21337a6
parent 16739 c20efe04cd7a
child 16748 0a730d3c5aae
osutil: handle deletion race with readdir/stat (issue3463)
mercurial/osutil.c
--- a/mercurial/osutil.c	Thu May 17 12:15:30 2012 -0500
+++ b/mercurial/osutil.c	Fri May 18 14:34:33 2012 -0500
@@ -331,6 +331,9 @@
 			err = lstat(fullpath, &st);
 #endif
 			if (err == -1) {
+				/* race with file deletion? */
+				if (errno == ENOENT)
+					continue;
 				strncpy(fullpath + pathlen + 1, ent->d_name,
 					PATH_MAX - pathlen);
 				fullpath[PATH_MAX] = 0;