]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Fix compiler warning in stropts.c
authorChuck Lever <chuck.lever@oracle.com>
Tue, 14 Jul 2009 20:58:38 +0000 (16:58 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 14 Jul 2009 20:58:38 +0000 (16:58 -0400)
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 <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/stropts.c

index e277b3d22ac791186c84f6cba11efa80ccae0cde..9d82bb141d37fbea3052c5ee02b0c5eb9cc6d75f 100644 (file)
@@ -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)