klibc-bot for Ben Hutchings
2019-Nov-05 22:42 UTC
[klibc] [klibc:master] losetup: Fix char signedness mismatches with <linux/loop.h>
Commit-ID: 8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Tue, 5 Nov 2019 00:39:53 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Tue, 5 Nov 2019 00:44:32 +0000 [klibc] losetup: Fix char signedness mismatches with <linux/loop.h> For some reason the kernel's definition of struct loop_info64 defines string fields as arrays of __u8 (unsigned char) instead of char. Add the necessary casts to avoid compiler warnings. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/utils/losetup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c index ebc6f360..1f50a001 100644 --- a/usr/utils/losetup.c +++ b/usr/utils/losetup.c @@ -94,7 +94,7 @@ static int show_loop(char *device) if (loopinfo64.lo_encrypt_type || loopinfo64.lo_crypt_name[0]) { - char *e = loopinfo64.lo_crypt_name; + const char *e = (const char *)loopinfo64.lo_crypt_name; if (*e == 0 && loopinfo64.lo_encrypt_type == 1) e = "XOR"; @@ -258,14 +258,14 @@ int 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); } } @@ -284,7 +284,7 @@ int 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; }