summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-11-01 14:09:35 +0100
committerJo-Philipp Wich <jo@mein.io>2023-11-01 14:14:15 +0100
commita69b5c8c416342a7855da19dfdc264a078f30848 (patch)
tree6b0957ca797a4ae418e6c5291cd22b887882a51c
parentea046bdae231988bda123995676e60db0aaa8745 (diff)
vm: fix unused result warning
When building against glibc with enabled source fortification, gcc reports the following issue: .../vm.c: In function ‘uc_vm_signal_raise’: .../vm.c:3161:9: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 3161 | write(vm->signal.sigpipe[1], &signum, sizeof(signum)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since we cannot do any meaningful handling of a potential write error in the affected signal handler context, simply solve this issue by wrapping the `write()` call into an empty `if ()` statement. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index f4bc308..3b7cb7c 100644
--- a/vm.c
+++ b/vm.c
@@ -3158,7 +3158,7 @@ uc_vm_signal_raise(uc_vm_t *vm, int signo)
vm->signal.raised[signo / 64] |= (1ull << (signo % 64));
- write(vm->signal.sigpipe[1], &signum, sizeof(signum));
+ if (write(vm->signal.sigpipe[1], &signum, sizeof(signum)) == -1) {}
}
int