line |
true |
false |
branch |
90
|
1502 |
57 |
if (path[0] == '/') { |
93
|
1 |
1501 |
if (path[1] == '\0') |
98
|
1 |
56 |
if (getcwd(resolved, MAXPATHLEN) == NULL) { |
105
|
1557 |
0 |
if (remaining_len >= sizeof(remaining) || resolved_len >= MAXPATHLEN) { |
|
0 |
1557 |
if (remaining_len >= sizeof(remaining) || resolved_len >= MAXPATHLEN) { |
113
|
11057 |
1557 |
while (remaining_len != 0) { |
121
|
1558 |
9499 |
s = p ? p : remaining + remaining_len; |
122
|
0 |
11057 |
if ((STRLEN)(s - remaining) >= (STRLEN)sizeof(next_token)) { |
129
|
9499 |
1558 |
if (p != NULL) |
131
|
9300 |
1757 |
if (resolved[resolved_len - 1] != '/') { |
132
|
0 |
9300 |
if (resolved_len + 1 >= MAXPATHLEN) { |
139
|
0 |
11057 |
if (next_token[0] == '\0') |
141
|
4 |
11053 |
else if (strEQ(next_token, ".")) |
143
|
255 |
10798 |
else if (strEQ(next_token, "..")) { |
148
|
255 |
0 |
if (resolved_len > 1) { |
163
|
0 |
10798 |
if (resolved_len >= MAXPATHLEN) { |
170
|
0 |
10798 |
if (lstat(resolved, &sb) != 0) { |
171
|
0 |
0 |
if (errno == ENOENT && p == NULL) { |
|
0 |
0 |
if (errno == ENOENT && p == NULL) { |
177
|
1 |
10797 |
if (S_ISLNK(sb.st_mode)) { |
181
|
0 |
1 |
if (symlinks++ > MAXSYMLINKS) { |
186
|
0 |
1 |
if (slen < 0) |
199
|
0 |
1 |
if (symlink[0] == '/') { |
202
|
1 |
0 |
} else if (resolved_len > 1) { |
215
|
0 |
1 |
if (p != NULL) { |
216
|
0 |
0 |
if (symlink[slen - 1] != '/') { |
217
|
0 |
0 |
if ((STRLEN)(slen + 1) >= (STRLEN)sizeof(symlink)) { |
225
|
0 |
0 |
if (remaining_len >= sizeof(remaining)) { |
243
|
1557 |
0 |
if (resolved_len > 1 && resolved[resolved_len - 1] == '/') |
|
4 |
1553 |
if (resolved_len > 1 && resolved[resolved_len - 1] == '/') |
460
|
1358 |
0 |
return SvPOK(invocant) && SvCUR(invocant) == 16 && |
|
98 |
1260 |
return SvPOK(invocant) && SvCUR(invocant) == 16 && |
|
70 |
28 |
return SvPOK(invocant) && SvCUR(invocant) == 16 && |
474
|
3 |
1743 |
SvGETMAGIC(path); |
|
0 |
3 |
SvGETMAGIC(path); |
475
|
4 |
1742 |
if(!SvOK(path)) return &PL_sv_undef; |
|
4 |
0 |
if(!SvOK(path)) return &PL_sv_undef; |
|
4 |
0 |
if(!SvOK(path)) return &PL_sv_undef; |
476
|
1738 |
4 |
p = SvPV_nomg(path, plen); |
477
|
6 |
1736 |
if(plen == 0) return newSVpvs(""); |
481
|
3 |
1733 |
if(SvUTF8(path)) SvUTF8_on(retval); |
499
|
908 |
828 |
if(p[0] == '/') { |
502
|
107 |
949 |
do { p++; } while(p[0] == '/'); |
503
|
41 |
908 |
if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) { |
|
21 |
20 |
if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) { |
|
18 |
3 |
if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) { |
|
18 |
0 |
if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) { |
506
|
20 |
908 |
} else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) { |
|
15 |
5 |
} else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) { |
|
15 |
0 |
} else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) { |
512
|
276 |
552 |
} else if(p[0] == '.' && p[1] == '/') { |
|
188 |
88 |
} else if(p[0] == '.' && p[1] == '/') { |
515
|
10 |
189 |
do { p++; } while(p[0] == '/'); |
516
|
2 |
187 |
} while(p[0] == '.' && p[1] == '/'); |
|
1 |
1 |
} while(p[0] == '.' && p[1] == '/'); |
517
|
39 |
149 |
if(p == pe) *o++ = '.'; |
519
|
105 |
1631 |
if(p == pe) goto end; |
522
|
763 |
4716 |
if(!q) q = pe; |
527
|
763 |
4716 |
if(p == pe) goto end; |
529
|
51 |
4737 |
do { p++; } while(p[0] == '/'); |
530
|
865 |
3872 |
if(p == pe) goto end; |
531
|
3319 |
553 |
if(p[0] != '.') break; |
532
|
3 |
550 |
if(p+1 == pe) goto end; |
533
|
529 |
21 |
if(p[1] != '/') break; |
542
|
1 |
1735 |
SvTAINT(retval); |
|
1 |
0 |
SvTAINT(retval); |
574
|
131 |
0 |
dXSTARG; |
576
|
4 |
127 |
if (ix == 1 && items != 0) |
|
0 |
4 |
if (ix == 1 && items != 0) |
579
|
18 |
113 |
XSprePUSH; PUSHTARG; |
580
|
18 |
113 |
SvTAINTED_on(TARG); |
588
|
1559 |
0 |
dXSTARG; |
589
|
1557 |
2 |
char *const path = pathsv ? SvPV_nolen(pathsv) : (char *)"."; |
|
1507 |
50 |
char *const path = pathsv ? SvPV_nolen(pathsv) : (char *)"."; |
592
|
1558 |
1 |
if ( |
601
|
254 |
1304 |
SvTAINTED_on(TARG); |
607
|
254 |
1305 |
SvTAINTED_on(TARG); |
670
|
928 |
0 |
EXTEND(SP, items+1); |
|
0 |
928 |
EXTEND(SP, items+1); |
674
|
55 |
873 |
if(invocant_is_unix(self)) { |
678
|
0 |
873 |
PUSHMARK(SP); |
679
|
0 |
873 |
EXTEND(SP, 2); |
698
|
4 |
0 |
EXTEND(SP, items+1); |
|
0 |
4 |
EXTEND(SP, items+1); |
711
|
15 |
415 |
if(invocant_is_unix(self)) { |
712
|
0 |
15 |
if(items == 1) { |
716
|
3 |
12 |
if(items == 2) { |
724
|
12 |
0 |
if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/') |
|
12 |
0 |
if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/') |
732
|
0 |
415 |
PUSHMARK(SP); |
733
|
0 |
415 |
EXTEND(SP, 2); |
735
|
414 |
1 |
PUSHs(items == 1 ? &PL_sv_undef : ST(items-1)); |
741
|
6 |
409 |
if(items <= 2) { |
749
|
0 |
409 |
PUSHMARK(&ST(-1)); |
755
|
409 |
0 |
pv = SvPV(dir, len); |
756
|
409 |
0 |
need_slash = len == 0 || pv[len-1] != '/'; |
|
385 |
24 |
need_slash = len == 0 || pv[len-1] != '/'; |
758
|
385 |
24 |
if(need_slash) sv_catsv(RETVAL, SLASH_STRING_SV); |
770
|
1 |
3 |
if(items == 0) { |
774
|
1 |
2 |
if(items == 1) { |
782
|
2 |
0 |
if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/') |
|
2 |
0 |
if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/') |