# HG changeset patch # User Matt Mackall # Date 2012-05-18 19:34:33 # Node ID 6476a21337a6942ee3b4b06ceb93f2902775e2b1 # Parent c20efe04cd7a265dc3b0f28ac56a88f5d9af8859 osutil: handle deletion race with readdir/stat (issue3463) diff --git a/mercurial/osutil.c b/mercurial/osutil.c --- a/mercurial/osutil.c +++ b/mercurial/osutil.c @@ -331,6 +331,9 @@ static PyObject *_listdir(char *path, in 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;