diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-07-02 13:46:48 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-07-02 13:46:48 +0200 |
commit | d699dac08778c597eefac1067a325059925e87e6 (patch) | |
tree | 686d80f3972ce3c433ccf9d2a5347d71ea9dce17 | |
parent | 5a9302bab9c9bb3d1577f04678d074fb7af4115f (diff) | |
download | seitan-d699dac08778c597eefac1067a325059925e87e6.tar seitan-d699dac08778c597eefac1067a325059925e87e6.tar.gz seitan-d699dac08778c597eefac1067a325059925e87e6.tar.bz2 seitan-d699dac08778c597eefac1067a325059925e87e6.tar.lz seitan-d699dac08778c597eefac1067a325059925e87e6.tar.xz seitan-d699dac08778c597eefac1067a325059925e87e6.tar.zst seitan-d699dac08778c597eefac1067a325059925e87e6.zip |
util: Fix system call name resolution in syscall_name() debug function
Fix the starting index, otherwise we miss the first call in sets
(say, mknod in filesystem calls).
And if we don't find a matching name for the system call, actually
return it, instead of trying to fetch it from the current (invalid)
call.
Fixes: bdbec30a8498 ("seitan: Add netlink, sendto()/sendmsg(), iovec handling, demo with routes")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | common/util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/util.c b/common/util.c index 3164126..f0a1df4 100644 --- a/common/util.c +++ b/common/util.c @@ -68,14 +68,16 @@ const char *syscall_name(long nr) { if (!call->name) { set++; call = set[0]; - continue; + + if (!*set) + return "unknown"; } if (nr == call->number) break; } - return call ? call->name : "unknown"; + return call->name; } const char *syscall_name_str[N_SYSCALL + 1] = { |