diff mercurial/osutil.c @ 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 edf7ae547b0e
children e248bff2d8dd
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;