diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-06 11:18:57 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-06 11:18:57 +0000 |
| commit | dedb199313d9cd1e53d1f629cf58145e3335152a (patch) | |
| tree | 4942979b113c3086f658b555aca87bf3024de022 | |
| parent | d01295998b7538a3b118cced426442192082c356 (diff) | |
| download | ruby-dedb199313d9cd1e53d1f629cf58145e3335152a.tar.gz ruby-dedb199313d9cd1e53d1f629cf58145e3335152a.tar.xz ruby-dedb199313d9cd1e53d1f629cf58145e3335152a.zip | |
* file.c (rb_file_s_readlink): readlink(2) on AIX fails with ERANGE if
buffer size is less than required. fixed: [ruby-dev:27634]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | file.c | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Sun Nov 6 20:13:27 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * file.c (rb_file_s_readlink): readlink(2) on AIX fails with ERANGE if + buffer size is less than required. fixed: [ruby-dev:27634] + Sat Nov 5 13:42:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in, cygwin/GNUmakefile.in (mingw): use def file to alias @@ -1982,7 +1982,13 @@ rb_file_s_readlink(VALUE klass, VALUE path) rb_secure(2); FilePathValue(path); buf = xmalloc(size); - while ((rv = readlink(StringValueCStr(path), buf, size)) == size) { + for (;;) { + rv = readlink(RSTRING(path)->ptr, buf, size); +#ifndef _AIX + if (rv != size) break; +#else + if (rv > 0 || errno != ERANGE) break; +#endif size *= 2; buf = xrealloc(buf, size); } |
