Skip to content

Commit

Permalink
vm: fix unused result warning
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jow- committed Nov 1, 2023
1 parent ea046bd commit a69b5c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a69b5c8

Please sign in to comment.