mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Fix -Wsign-compare warnings in realpath.c
This is needed in order to build realpath.c as part of rtld.
This commit is contained in:
parent
c2c5d1e787
commit
df5e392483
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349416
@ -91,7 +91,7 @@ realpath1(const char *path, char *resolved)
|
||||
*/
|
||||
p = strchr(left, '/');
|
||||
|
||||
next_token_len = p != NULL ? p - left : left_len;
|
||||
next_token_len = p != NULL ? (size_t)(p - left) : left_len;
|
||||
memcpy(next_token, left, next_token_len);
|
||||
next_token[next_token_len] = '\0';
|
||||
|
||||
@ -146,7 +146,7 @@ realpath1(const char *path, char *resolved)
|
||||
return (NULL);
|
||||
}
|
||||
slen = readlink(resolved, symlink, sizeof(symlink));
|
||||
if (slen <= 0 || slen >= sizeof(symlink)) {
|
||||
if (slen <= 0 || slen >= (ssize_t)sizeof(symlink)) {
|
||||
if (slen < 0)
|
||||
; /* keep errno from readlink(2) call */
|
||||
else if (slen == 0)
|
||||
@ -173,7 +173,7 @@ realpath1(const char *path, char *resolved)
|
||||
*/
|
||||
if (p != NULL) {
|
||||
if (symlink[slen - 1] != '/') {
|
||||
if (slen + 1 >= sizeof(symlink)) {
|
||||
if (slen + 1 >= (ssize_t)sizeof(symlink)) {
|
||||
errno = ENAMETOOLONG;
|
||||
return (NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user