Project

General

Profile

Backport #7754 ยป file.c.patch

View differences:

trunk/file.c 2012/10/12 18:01:56 37174
#ifdef HAVE_READLINK
if (S_ISLNK(sbuf.st_mode)) {
VALUE link;
volatile VALUE link_orig = Qnil;
const char *link_prefix, *link_names;
long link_prefixlen;
rb_hash_aset(loopcheck, testpath, ID2SYM(resolving));
......
link_prefixlen = link_names - link_prefix;
if (link_prefixlen > 0) {
rb_encoding *enc, *linkenc = rb_enc_get(link);
link_orig = link;
link = rb_str_subseq(link, 0, link_prefixlen);
enc = rb_enc_check(*resolvedp, link);
if (enc != linkenc) link = rb_str_conv_enc(link, linkenc, enc);
......
*prefixlenp = link_prefixlen;
}
realpath_rec(prefixlenp, resolvedp, link_names, loopcheck, strict, *unresolved_firstsep == '\0');
RB_GC_GUARD(link_orig);
rb_hash_aset(loopcheck, testpath, rb_str_dup_frozen(*resolvedp));
}
else
    (1-1/1)