[PATCH 29/31] mount.nfs: Fix compiler warning in stropts.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

 utils/mount/stropts.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

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)

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux