[openssh-commits] [openssh] 01/01: make realpath.c compile -Wsign-compare clean

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Jul 20 11:20:41 AEST 2015


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit d56fd1828074a4031b18b8faa0bf949669eb18a0
Author: Damien Miller <djm at mindrot.org>
Date:   Mon Jul 20 11:19:51 2015 +1000

    make realpath.c compile -Wsign-compare clean
---
 openbsd-compat/realpath.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c
index b6120d0..ba4cea9 100644
--- a/openbsd-compat/realpath.c
+++ b/openbsd-compat/realpath.c
@@ -33,11 +33,13 @@
 
 #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)
 
+#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 
 #include <errno.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -90,7 +92,7 @@ realpath(const char *path, char resolved[PATH_MAX])
 		 */
 		p = strchr(left, '/');
 		s = p ? p : left + left_len;
-		if (s - left >= sizeof(next_token)) {
+		if (s - left >= (ptrdiff_t)sizeof(next_token)) {
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -169,7 +171,8 @@ realpath(const char *path, char resolved[PATH_MAX])
 			 */
 			if (p != NULL) {
 				if (symlink[slen - 1] != '/') {
-					if (slen + 1 >= sizeof(symlink)) {
+					if (slen + 1 >=
+					    (ptrdiff_t)sizeof(symlink)) {
 						errno = ENAMETOOLONG;
 						return (NULL);
 					}

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list