From 830d6af09972a79ae7a6786afcb567d9d2cd5d24 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 8 Oct 2007 09:59:18 -0700 Subject: [PATCH] losetup: clean up gcc warnings 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 --- mount/lomount.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mount/lomount.c b/mount/lomount.c index ace474cb..737194e9 100644 --- a/mount/lomount.c +++ b/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 *file, unsigned long long offset, 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 *file, unsigned long long offset, 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; } -- 2.39.5