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 | 556a7ac35fb1e64c35c56d9c09f2c6f6ee0a1209 (patch) | |
tree | 4942979b113c3086f658b555aca87bf3024de022 /file.c | |
parent | 563ff316254eca0d19be0d88d288ee39deb85490 (diff) |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@9505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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); } |