diff --git a/strbuf.c b/strbuf.c index 35150610c1..fbc60ed587 100644 --- a/strbuf.c +++ b/strbuf.c @@ -395,8 +395,6 @@ ssize_t strbuf_read_once(struct strbuf *sb, int fd, size_t hint) return cnt; } -#define STRBUF_MAXLINK (2*PATH_MAX) - int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) { size_t oldalloc = sb->alloc; @@ -404,7 +402,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) if (hint < 32) hint = 32; - while (hint < STRBUF_MAXLINK) { + for (;; hint *= 2) { int len; strbuf_grow(sb, hint + 1); @@ -416,9 +414,6 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) strbuf_setlen(sb, len); return 0; } - - /* .. the buffer was too small - try again */ - hint *= 2; } if (oldalloc == 0) strbuf_release(sb);