diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-11-05 00:39:53 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-11-05 00:44:32 +0000 |
commit | 8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5 (patch) | |
tree | 863b1903541c225d85733a4cd6a0ca18030bec3a | |
parent | 547b7cf241d4bcf518759d06cff694b9738c57b0 (diff) | |
download | klibc-8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5.tar.gz |
[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@decadent.org.uk>
-rw-r--r-- | usr/utils/losetup.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c index ebc6f360af6e85..1f50a001f9e268 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; } |