Skip to content

Commit 865ab35

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 d76993c commit 865ab35

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

strbuf.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -559,16 +559,14 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
559559
return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0;
560560
}
561561

562-
#define STRBUF_MAXLINK (2*PATH_MAX)
563-
564562
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
565563
{
566564
size_t oldalloc = sb->alloc;
567565

568566
if (hint < 32)
569567
hint = 32;
570568

571-
while (hint < STRBUF_MAXLINK) {
569+
for (;;) {
572570
ssize_t len;
573571

574572
strbuf_grow(sb, hint + 1);

0 commit comments

Comments
 (0)