# HG changeset patch # User Matt Mackall # Date 1310594331 18000 # Node ID f79d47813b8b903f998e548f83043f141d68012c # Parent 15afa4984a947293c191469bc21b47f03ca1192e osutil: emulate os.listdir's OSError for long names (issue2898) diff -r 15afa4984a94 -r f79d47813b8b mercurial/osutil.c --- a/mercurial/osutil.c Wed Jul 13 16:28:46 2011 -0500 +++ b/mercurial/osutil.c Wed Jul 13 16:58:51 2011 -0500 @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef _WIN32 #include @@ -288,7 +289,8 @@ #endif if (pathlen >= PATH_MAX) { - PyErr_SetString(PyExc_ValueError, "path too long"); + errno = ENAMETOOLONG; + PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); goto error_value; } strncpy(fullpath, path, PATH_MAX);