changeset 16747:6476a21337a6 stable

osutil: handle deletion race with readdir/stat (issue3463)
author Matt Mackall <mpm@selenic.com>
date Fri, 18 May 2012 14:34:33 -0500
parents c20efe04cd7a
children 0a730d3c5aae
files mercurial/osutil.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;