Mercurial > hg-stable
comparison mercurial/osutil.c @ 14873:f79d47813b8b
osutil: emulate os.listdir's OSError for long names (issue2898)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 13 Jul 2011 16:58:51 -0500 |
parents | 26f8844d1757 |
children | edf7ae547b0e |
comparison
equal
deleted
inserted
replaced
14872:15afa4984a94 | 14873:f79d47813b8b |
---|---|
10 #define _ATFILE_SOURCE | 10 #define _ATFILE_SOURCE |
11 #include <Python.h> | 11 #include <Python.h> |
12 #include <fcntl.h> | 12 #include <fcntl.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <errno.h> | |
15 | 16 |
16 #ifdef _WIN32 | 17 #ifdef _WIN32 |
17 #include <windows.h> | 18 #include <windows.h> |
18 #include <io.h> | 19 #include <io.h> |
19 #else | 20 #else |
286 #ifdef AT_SYMLINK_NOFOLLOW | 287 #ifdef AT_SYMLINK_NOFOLLOW |
287 int dfd = -1; | 288 int dfd = -1; |
288 #endif | 289 #endif |
289 | 290 |
290 if (pathlen >= PATH_MAX) { | 291 if (pathlen >= PATH_MAX) { |
291 PyErr_SetString(PyExc_ValueError, "path too long"); | 292 errno = ENAMETOOLONG; |
293 PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); | |
292 goto error_value; | 294 goto error_value; |
293 } | 295 } |
294 strncpy(fullpath, path, PATH_MAX); | 296 strncpy(fullpath, path, PATH_MAX); |
295 fullpath[pathlen] = '/'; | 297 fullpath[pathlen] = '/'; |
296 | 298 |