summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-14 14:52:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-14 14:52:55 +0000
commitd1efa4d03cdd29577db476fd4121a07263f19c67 (patch)
tree03297ce8bb5422827be37b9b9906012730c98aa0 /file.c
parenta4564834364c9a60eac4bf591dc7764bc576d9d4 (diff)
downloadruby-d1efa4d03cdd29577db476fd4121a07263f19c67.tar.gz
ruby-d1efa4d03cdd29577db476fd4121a07263f19c67.tar.xz
ruby-d1efa4d03cdd29577db476fd4121a07263f19c67.zip
* file.c (rb_file_s_readlink): ERANGE will occur only on GPFS.
[ruby-dev:27699] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/file.c b/file.c
index decb5ba81..8db72a089 100644
--- a/file.c
+++ b/file.c
@@ -2051,13 +2051,11 @@ rb_file_s_readlink(klass, path)
SafeStringValue(path);
buf = xmalloc(size);
- for (;;) {
- rv = readlink(RSTRING(path)->ptr, buf, size);
-#ifndef _AIX
- if (rv != size) break;
-#else
- if (rv > 0 || errno != ERANGE) break;
+ while ((rv = readlink(RSTRING(path)->ptr, buf, size)) == size
+#ifdef _AIX
+ || (rv < 0 && errno == ERANGE) /* quirky behavior of GPFS */
#endif
+ ) {
size *= 2;
buf = xrealloc(buf, size);
}