mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
563ff31625
commit
556a7ac35f
2 changed files with 12 additions and 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
|
||||
|
|
8
file.c
8
file.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue