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 e277b3d..9d82bb1 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];
 {
        char address[NI_MAXHOST];
        char new_option[512];
+       int len;
 
        if (!nfs_present_sockaddr(sap, salen, address, sizeof(address)))
                goto out_err;
 
 
        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)
                goto out_err;
 
        if (po_append(options, new_option) != PO_SUCCEEDED)