# HG changeset patch # User Benoit Boissinot # Date 2008-09-10 20:37:07 # Node ID bdc8d00c4ffa41fd4eb6352046efb67f863f364a # Parent 75ce89ed3b6e0789f4d95017b34d6d1060cc5d92 osutil: proper error checking and reporting diff --git a/mercurial/osutil.c b/mercurial/osutil.c --- a/mercurial/osutil.c +++ b/mercurial/osutil.c @@ -255,7 +255,8 @@ static PyObject *listdir(PyObject *self, #ifdef AT_SYMLINK_NOFOLLOW dfd = open(path, O_RDONLY); - dir = fdopendir(dfd); + if (dfd != -1) + dir = fdopendir(dfd); #else dir = opendir(path); dfd = -1;