[PATCH v2 2/9] Fix key_t argument printing in IPC *get calls
Eugene Syromyatnikov
evgsyr at gmail.com
Thu Sep 8 14:06:00 UTC 2016
key_t is actually int.
* ipc_msg.c (SYS_FUNC(msgget)): Change format specifier of the first
argument to "%#x".
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm (SYS_FUNC(shmget)): Likewise.
---
ipc_msg.c | 5 +++--
ipc_sem.c | 5 +++--
ipc_shm.c | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/ipc_msg.c b/ipc_msg.c
index f04d14d..24bc336 100644
--- a/ipc_msg.c
+++ b/ipc_msg.c
@@ -44,8 +44,9 @@
SYS_FUNC(msgget)
{
- if (tcp->u_arg[0])
- tprintf("%#lx, ", tcp->u_arg[0]);
+ /* key_t is __kernel_key_t in kernel, which is typedef'ed to int*/
+ if ((int) tcp->u_arg[0])
+ tprintf("%#x, ", (int) tcp->u_arg[0]);
else
tprints("IPC_PRIVATE, ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
diff --git a/ipc_sem.c b/ipc_sem.c
index 81a2ff7..0de0fe7 100644
--- a/ipc_sem.c
+++ b/ipc_sem.c
@@ -101,8 +101,9 @@ SYS_FUNC(semtimedop)
SYS_FUNC(semget)
{
- if (tcp->u_arg[0])
- tprintf("%#lx", tcp->u_arg[0]);
+ /* key_t is __kernel_key_t in kernel, which is typedef'ed to int*/
+ if ((int) tcp->u_arg[0])
+ tprintf("%#x", (int) tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %d, ", (int) tcp->u_arg[1]);
diff --git a/ipc_shm.c b/ipc_shm.c
index 072c5e1..ef2d0e9 100644
--- a/ipc_shm.c
+++ b/ipc_shm.c
@@ -43,8 +43,9 @@
SYS_FUNC(shmget)
{
- if (tcp->u_arg[0])
- tprintf("%#lx", tcp->u_arg[0]);
+ /* key_t is __kernel_key_t in kernel, which is typedef'ed to int*/
+ if ((int) tcp->u_arg[0])
+ tprintf("%#x", (int) tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
--
1.7.10.4
More information about the Strace-devel
mailing list