mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
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:
parent
4f89d9be86
commit
79345cc0b9
@ -1,3 +1,3 @@
|
||||
CCAN imported from http://ccodearchive.net.
|
||||
|
||||
CCAN version: init-2483-g920ca95d
|
||||
CCAN version: init-2484-ge16aa40b
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user