Skip to content

Commit

Permalink
lib/fs/readlink/readlinknul.h: readlinknul(): Silence warning
Browse files Browse the repository at this point in the history
Use a temporary variable to silence a sign-mismatch diagnostic.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • Loading branch information
alejandro-colomar committed Nov 13, 2024
1 parent 9c99500 commit 340b554
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/fs/readlink/readlinknul.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 340b554

Please sign in to comment.