From: Karel Zak Date: Mon, 1 Aug 2011 09:59:48 +0000 (+0200) Subject: lib: [sysfs.c] fix compiler warnings [-Wsign-compare] X-Git-Tag: v2.20-rc2~158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b9166ce06ed3ad0d61fda4106637603b71ea7a2;p=thirdparty%2Futil-linux.git lib: [sysfs.c] fix compiler warnings [-Wsign-compare] Signed-off-by: Karel Zak --- diff --git a/lib/sysfs.c b/lib/sysfs.c index 7bcdabae28..eec1f243b9 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -19,7 +19,7 @@ char *sysfs_devno_attribute_path(dev_t devno, char *buf, len = snprintf(buf, bufsiz, _PATH_SYS_DEVBLOCK "/%d:%d", major(devno), minor(devno)); - return (len < 0 || len + 1 > bufsiz) ? NULL : buf; + return (len < 0 || (size_t) len + 1 > bufsiz) ? NULL : buf; } int sysfs_devno_has_attribute(dev_t devno, const char *attr) @@ -62,7 +62,7 @@ dev_t sysfs_devname_to_devno(const char *name, const char *parent) */ int len = snprintf(buf, sizeof(buf), _PATH_SYS_BLOCK "/%s/%s/dev", parent, name); - if (len < 0 || len + 1 > sizeof(buf)) + if (len < 0 || (size_t) len + 1 > sizeof(buf)) return 0; path = buf; @@ -72,7 +72,7 @@ dev_t sysfs_devname_to_devno(const char *name, const char *parent) */ int len = snprintf(buf, sizeof(buf), _PATH_SYS_BLOCK "/%s/dev", name); - if (len < 0 || len + 1 > sizeof(buf)) + if (len < 0 || (size_t) len + 1 > sizeof(buf)) return 0; path = buf; }