]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
make realpath.c compile -Wsign-compare clean
authorDamien Miller <djm@mindrot.org>
Mon, 20 Jul 2015 01:19:51 +0000 (11:19 +1000)
committerDamien Miller <djm@mindrot.org>
Mon, 20 Jul 2015 01:19:51 +0000 (11:19 +1000)
openbsd-compat/realpath.c

index b6120d034d5dfb51318841370aeec212f27e95fd..ba4cea93894fa4e8ec973002dc54adc476804066 100644 (file)
 
 #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);
                                        }