From 340b5544364f64c31a926a399addfa37101e384a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 2 Nov 2024 12:28:44 +0100 Subject: [PATCH] lib/fs/readlink/readlinknul.h: readlinknul(): Silence warning Use a temporary variable to silence a sign-mismatch diagnostic. Signed-off-by: Alejandro Colomar --- lib/fs/readlink/readlinknul.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/fs/readlink/readlinknul.h b/lib/fs/readlink/readlinknul.h index 7c77ca5d7..df42629b2 100644 --- a/lib/fs/readlink/readlinknul.h +++ b/lib/fs/readlink/readlinknul.h @@ -30,12 +30,14 @@ inline int readlinknul(const char *restrict link, char *restrict buf, inline int readlinknul(const char *restrict link, char *restrict buf, size_t size) { - ssize_t len; + size_t len; + ssize_t r; - len = readlink(link, buf, size); - if (len == -1) + r = readlink(link, buf, size); + if (r == -1) return -1; + len = r; if (len == size) { stpcpy(&buf[size-1], ""); errno = E2BIG;