]> granicus.if.org Git - strace/commitdiff
tests: cast printf arguments to short when %h format qualifier is used
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 2 Jun 2018 16:25:56 +0000 (18:25 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 2 Jun 2018 16:32:10 +0000 (16:32 +0000)
Reported by clang.

* tests/mknod.c (main): Cast printf argument for %#03ho format to short.
* tests/mknodat.c (main): Likewise.
* tests/net-sockaddr.c (main): Cast printf argument for %hu format
to short.
* tests/semop.c (main): Likewise.

tests/mknod.c
tests/mknodat.c
tests/net-sockaddr.c
tests/semop.c

index b38714990617a669ea9fb5ab976d0f38303b7fbb..4bcc2744cc1597981241d91170c8249bc67e92dc 100644 (file)
@@ -59,7 +59,7 @@ main(int ac, char **av)
        rc = call_mknod(mode, dev);
        printf("mknod(\"%s\", S_IFBLK|S_ISUID|S_ISGID|S_ISVTX|%#03ho"
               ", makedev(%u, %u)) = %ld %s (%m)\n",
-              sample, mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX),
+              sample, (short) (mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX)),
               major((unsigned) dev), minor((unsigned) dev),
               rc, errno2name());
 
index 756e277138ee70f3eb67fa68bb3f0b0e1a626a5d..318dc5a6cde763469e687c13d82cb71e44c77afa 100644 (file)
@@ -59,7 +59,7 @@ main(void)
        rc = call_mknodat(mode, dev);
        printf("mknodat(-1, \"%s\", S_IFBLK|S_ISUID|S_ISGID|S_ISVTX|%#03ho"
               ", makedev(%u, %u)) = %ld %s (%m)\n",
-              sample, mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX),
+              sample, (short) (mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX)),
               major((unsigned) dev), minor((unsigned) dev),
               rc, errno2name());
 
index 0e2950c12167b7839773aa99b4f156a58b95804e..64427d1bca7f9f5677e4bac5ea7c9acf476f7e07 100644 (file)
@@ -456,11 +456,12 @@ check_l2(void)
 #ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE
               ", l2_bdaddr_type=0xce /* BDADDR_??? */"
 #endif
-              "}, %u) = %d EBADF (%m)\n", h_psm - 0x1001,
+              "}, %u) = %d EBADF (%m)\n",
+              (short) (h_psm - 0x1001),
               c_l2.l2_bdaddr.b[0], c_l2.l2_bdaddr.b[1],
               c_l2.l2_bdaddr.b[2], c_l2.l2_bdaddr.b[3],
               c_l2.l2_bdaddr.b[4], c_l2.l2_bdaddr.b[5],
-              h_cid - 0x40, len, ret);
+              (short) (h_cid - 0x40), len, ret);
 
        c_l2.l2_psm = htobs(1);
        c_l2.l2_cid = htobs(1);
index 350806c57f239a34252ea644d2501e10d1357448..4b14882cefc4b664ac595af3be17a0919cc843b5 100644 (file)
@@ -68,7 +68,7 @@ main(void)
                bogus_semid, sem_b2->sem_num, sem_b2->sem_op,
                sem_b2->sem_flg & SEM_UNDO ? "SEM_UNDO|" : "",
                sem_b2->sem_flg & IPC_NOWAIT ? "IPC_NOWAIT|" : "",
-               sem_b2->sem_flg & ~(SEM_UNDO | IPC_NOWAIT),
+               (short) (sem_b2->sem_flg & ~(SEM_UNDO | IPC_NOWAIT)),
                sem_b2 + 1, 2, sprintrc(rc));
 
        if (semop(id, sem_b, 1))
@@ -96,7 +96,7 @@ main(void)
                bogus_semid, sem_b2->sem_num, sem_b2->sem_op,
                sem_b2->sem_flg & SEM_UNDO ? "SEM_UNDO|" : "",
                sem_b2->sem_flg & IPC_NOWAIT ? "IPC_NOWAIT|" : "",
-               sem_b2->sem_flg & ~(SEM_UNDO | IPC_NOWAIT),
+               (short) (sem_b2->sem_flg & ~(SEM_UNDO | IPC_NOWAIT)),
                sem_b2 + 1, 2,
                (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec),
                sprintrc(rc));