From: Chuck Lever Date: Tue, 14 Jul 2009 20:58:38 +0000 (-0400) Subject: mount.nfs: Fix compiler warning in stropts.c X-Git-Tag: nfs-utils-1-2-1-rc2~4 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=ae548c2d55e442c96ad51e90c1e00ce3eb0b718b;p=nfs-utils.git mount.nfs: Fix compiler warning in stropts.c Address compiler warning: stropts.c: In function ¿nfs_append_generic_address_option¿: stropts.c:138: warning: comparison between signed and unsigned Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index e277b3d..9d82bb1 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -130,12 +130,14 @@ static int nfs_append_generic_address_option(const struct sockaddr *sap, { char address[NI_MAXHOST]; char new_option[512]; + int len; if (!nfs_present_sockaddr(sap, salen, address, sizeof(address))) goto out_err; - if (snprintf(new_option, sizeof(new_option), "%s=%s", - keyword, address) >= sizeof(new_option)) + len = snprintf(new_option, sizeof(new_option), "%s=%s", + keyword, address); + if (len < 0 || (size_t)len >= sizeof(new_option)) goto out_err; if (po_append(options, new_option) != PO_SUCCEEDED)