ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.129 by root, Sun Apr 14 09:43:19 2013 UTC vs.
Revision 1.130 by root, Thu May 9 03:03:24 2013 UTC

968 968
969/* result will always end up in tmpbuf, there is always space for adding a 0-byte */ 969/* result will always end up in tmpbuf, there is always space for adding a 0-byte */
970static int 970static int
971eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) 971eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
972{ 972{
973 char *res;
973 const char *rel = path; 974 const char *rel = path;
974 char *res;
975 char *tmp1, *tmp2; 975 char *tmp1, *tmp2;
976#if SYMLOOP_MAX > 32 976#if SYMLOOP_MAX > 32
977 int symlinks = SYMLOOP_MAX; 977 int symlinks = SYMLOOP_MAX;
978#else 978#else
979 int symlinks = 32; 979 int symlinks = 32;
986 errno = ENOENT; 986 errno = ENOENT;
987 if (!*rel) 987 if (!*rel)
988 return -1; 988 return -1;
989 989
990 res = tmpbuf_get (tmpbuf, PATH_MAX * 3); 990 res = tmpbuf_get (tmpbuf, PATH_MAX * 3);
991#ifdef _WIN32
992 if (_access (rel, 4) != 0)
993 return -1;
994
995 symlinks = GetFullPathName (rel, PATH_MAX * 3, res, 0);
996
997 errno = ENAMETOOLONG;
998 if (symlinks >= PATH_MAX * 3)
999 return -1;
1000
1001 errno = EIO;
1002 if (symlinks <= 0)
1003 return -1;
1004
1005 return symlinks;
1006
1007#else
991 tmp1 = res + PATH_MAX; 1008 tmp1 = res + PATH_MAX;
992 tmp2 = tmp1 + PATH_MAX; 1009 tmp2 = tmp1 + PATH_MAX;
993 1010
994#if 0 /* disabled, the musl way to do things is just too racy */ 1011#if 0 /* disabled, the musl way to do things is just too racy */
995#if __linux && defined(O_NONBLOCK) && defined(O_NOATIME) 1012#if __linux && defined(O_NONBLOCK) && defined(O_NOATIME)
1118 /* special case for the lone root path */ 1135 /* special case for the lone root path */
1119 if (res == tmpbuf->ptr) 1136 if (res == tmpbuf->ptr)
1120 *res++ = '/'; 1137 *res++ = '/';
1121 1138
1122 return res - (char *)tmpbuf->ptr; 1139 return res - (char *)tmpbuf->ptr;
1140#endif
1123} 1141}
1124 1142
1125static signed char 1143static signed char
1126eio_dent_cmp (const eio_dirent *a, const eio_dirent *b) 1144eio_dent_cmp (const eio_dirent *a, const eio_dirent *b)
1127{ 1145{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines