[PATCH] lomount: clean up gcc warnings

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

 



From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Fix strict gcc warnings that come from using:
  ("-Wall -Wp,-D_FORTIFY_SOURCE=2")

lomount.c:98: warning: pointer targets in initialization differ in signedness
lomount.c:111: warning: format '%04x' expects type 'unsigned int', but argument 4 has type '__kernel_old_dev_t'
lomount.c:300: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
lomount.c:307: warning: pointer targets in passing argument 1 of '__builtin___snprintf_chk' differ in signedness
lomount.c:339: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 mount/lomount.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- util-linux-ng-2.13.orig/mount/lomount.c
+++ util-linux-ng-2.13/mount/lomount.c
@@ -95,7 +95,7 @@ show_loop(char *device) {
 
 		if (loopinfo64.lo_encrypt_type ||
 		    loopinfo64.lo_crypt_name[0]) {
-			char *e = loopinfo64.lo_crypt_name;
+			char *e = (char *)loopinfo64.lo_crypt_name;
 
 			if (*e == 0 && loopinfo64.lo_encrypt_type == 1)
 				e = "XOR";
@@ -109,7 +109,7 @@ show_loop(char *device) {
 
 	if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == 0) {
 		printf ("%s: [%04x]:%ld (%s)",
-			device, loopinfo.lo_device, loopinfo.lo_inode,
+			device, (unsigned int)loopinfo.lo_device, loopinfo.lo_inode,
 			loopinfo.lo_name);
 
 		if (loopinfo.lo_offset)
@@ -297,14 +297,14 @@ set_loop(const char *device, const char 
 
 	memset(&loopinfo64, 0, sizeof(loopinfo64));
 
-	xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE);
+	xstrncpy((char *)loopinfo64.lo_file_name, file, LO_NAME_SIZE);
 
 	if (encryption && *encryption) {
 		if (digits_only(encryption)) {
 			loopinfo64.lo_encrypt_type = atoi(encryption);
 		} else {
 			loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI;
-			snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE,
+			snprintf((char *)loopinfo64.lo_crypt_name, LO_NAME_SIZE,
 				 "%s", encryption);
 		}
 	}
@@ -336,7 +336,7 @@ set_loop(const char *device, const char 
 		pass = xgetpass(pfd, _("Password: "));
 	gotpass:
 		memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE);
-		xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
+		xstrncpy((char *)loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
 		memset(pass, 0, strlen(pass));
 		loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
 	}
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux