Skip to content

Commit 37dbe34

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 <blees@dcon.de>
1 parent 740b127 commit 37dbe34

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
@@ -459,16 +459,14 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
459459
}
460460

461461

462-
#define STRBUF_MAXLINK (2*PATH_MAX)
463-
464462
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
465463
{
466464
size_t oldalloc = sb->alloc;
467465

468466
if (hint < 32)
469467
hint = 32;
470468

471-
while (hint < STRBUF_MAXLINK) {
469+
for (;;) {
472470
ssize_t len;
473471

474472
strbuf_grow(sb, hint + 1);

0 commit comments

Comments
 (0)