]> err.no Git - util-linux/commitdiff
losetup: clean up gcc warnings
authorRandy Dunlap <randy.dunlap@oracle.com>
Mon, 8 Oct 2007 16:59:18 +0000 (09:59 -0700)
committerKarel Zak <kzak@redhat.com>
Thu, 11 Oct 2007 11:02:45 +0000 (13:02 +0200)
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@oracle.com>
mount/lomount.c

index ace474cb34b3d8d1505196a393ba3fe35760f555..737194e912a1d5c54a7ea41079e57a9aef8e09be 100644 (file)
@@ -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;
        }