summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-06 11:18:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-06 11:18:57 +0000
commit6609fbb02b6d5f006860011b23f6d1154d0f35c3 (patch)
tree2683f9662256f7d9cb72c94282b2599fdbff4bf3 /file.c
parent06980f4807e6970b919efb914c3070a3df90af4f (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/branches/ruby_1_8@9505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/file.c b/file.c
index 2e465e2d89..898c8009aa 100644
--- a/file.c
+++ b/file.c
@@ -2019,7 +2019,13 @@ rb_file_s_readlink(klass, path)
SafeStringValue(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);
}