Commit e16aa40b authored by Chirimen-Jako's avatar Chirimen-Jako Committed by Rusty Russell

Suppress false positive warning "-Wmaybe-uninitialized" with GCC -O3

parent 920ca95d
...@@ -302,7 +302,7 @@ fail_take_to: ...@@ -302,7 +302,7 @@ fail_take_to:
char *path_readlink(const tal_t *ctx, const char *linkname) 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; char *ret = NULL;
if (unlikely(!linkname) && is_taken(linkname)) if (unlikely(!linkname) && is_taken(linkname))
...@@ -311,19 +311,20 @@ fail_take_to: ...@@ -311,19 +311,20 @@ fail_take_to:
ret = tal_arr(ctx, char, maxlen + 1); ret = tal_arr(ctx, char, maxlen + 1);
while (ret) { while (ret) {
len = readlink(linkname, ret, maxlen); ssize_t len = readlink(linkname, ret, maxlen);
if (len < 0) if (len < 0)
goto fail; goto fail;
if (len < maxlen)
if (len < maxlen) {
ret[len] = '\0';
break; break;
}
if (!tal_resize(&ret, maxlen *= 2 + 1)) if (!tal_resize(&ret, maxlen *= 2 + 1))
goto fail; goto fail;
} }
if (ret)
ret[len] = '\0';
out: out:
if (taken(linkname)) if (taken(linkname))
tal_free(linkname); tal_free(linkname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment