Skip to content

Commit a0f945b

Browse files
kbleesdscho
authored andcommitted
strbuf_readlink: support link targets that exceed PATH_MAX
strbuf_readlink() refuses to read link targets that exceed PATH_MAX (even if a sufficient size was specified by the caller). As some platforms support longer paths, remove this restriction (similar to strbuf_getcwd()). Signed-off-by: Karsten Blees <[email protected]>
1 parent 1bb4f92 commit a0f945b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

strbuf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,14 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
553553
return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0;
554554
}
555555

556-
#define STRBUF_MAXLINK (2*PATH_MAX)
557-
558556
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
559557
{
560558
size_t oldalloc = sb->alloc;
561559

562560
if (hint < 32)
563561
hint = 32;
564562

565-
while (hint < STRBUF_MAXLINK) {
563+
for (;;) {
566564
ssize_t len;
567565

568566
strbuf_grow(sb, hint + 1);

0 commit comments

Comments
 (0)