Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2019 15:43:20 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349416 - head/lib/libc/stdlib
Message-ID:  <201906261543.x5QFhKTA024799@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arichardson
Date: Wed Jun 26 15:43:20 2019
New Revision: 349416
URL: https://svnweb.freebsd.org/changeset/base/349416

Log:
  Fix -Wsign-compare warnings in realpath.c
  
  This is needed in order to build realpath.c as part of rtld.

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Wed Jun 26 15:34:35 2019	(r349415)
+++ head/lib/libc/stdlib/realpath.c	Wed Jun 26 15:43:20 2019	(r349416)
@@ -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);
 					}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906261543.x5QFhKTA024799>