CCAN: update to suppress path_readlink warning.

Reported-by: Chirimen-Jako
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-08-01 11:04:05 +09:30 committed by Christian Decker
parent 4f89d9be86
commit 79345cc0b9
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net.
CCAN version: init-2483-g920ca95d
CCAN version: init-2484-ge16aa40b

View File

@ -302,7 +302,7 @@ fail_take_to:
char *path_readlink(const tal_t *ctx, const char *linkname)
{
ssize_t len, maxlen = 64; /* good first guess. */
ssize_t maxlen = 64; /* good first guess. */
char *ret = NULL;
if (unlikely(!linkname) && is_taken(linkname))
@ -311,19 +311,20 @@ fail_take_to:
ret = tal_arr(ctx, char, maxlen + 1);
while (ret) {
len = readlink(linkname, ret, maxlen);
ssize_t len = readlink(linkname, ret, maxlen);
if (len < 0)
goto fail;
if (len < maxlen)
if (len < maxlen) {
ret[len] = '\0';
break;
}
if (!tal_resize(&ret, maxlen *= 2 + 1))
goto fail;
}
if (ret)
ret[len] = '\0';
out:
if (taken(linkname))
tal_free(linkname);