Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 18c76a0

Browse files
enh-googleGerrit Code Review
authored andcommitted
Merge "sigqueue/pthread_sigqueue: cleanup." into main
2 parents e1c232d + 3bf404c commit 18c76a0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

libc/bionic/pthread_sigqueue.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ __BIONIC_WEAK_FOR_NATIVE_BRIDGE
4040
int pthread_sigqueue(pthread_t t, int sig, const union sigval value) {
4141
ErrnoRestorer errno_restorer;
4242

43+
pid_t pid = getpid();
44+
4345
pid_t tid = __pthread_internal_gettid(t, "pthread_sigqueue");
4446
if (tid == -1) return ESRCH;
4547

46-
siginfo_t siginfo;
47-
siginfo.si_code = SI_QUEUE;
48-
siginfo.si_pid = getpid();
48+
siginfo_t siginfo = { .si_code = SI_QUEUE };
49+
siginfo.si_signo = sig;
50+
siginfo.si_pid = pid;
4951
siginfo.si_uid = getuid();
5052
siginfo.si_value = value;
5153

52-
return syscall(__NR_rt_tgsigqueueinfo, getpid(), tid, sig, &siginfo) ? errno : 0;
54+
return syscall(__NR_rt_tgsigqueueinfo, pid, tid, sig, &siginfo) ? errno : 0;
5355
}

libc/bionic/signal.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,8 @@ int sigpending64(sigset64_t* set) {
219219
}
220220

221221
int sigqueue(pid_t pid, int sig, const sigval value) {
222-
siginfo_t info;
223-
memset(&info, 0, sizeof(siginfo_t));
222+
siginfo_t info = { .si_code = SI_QUEUE };
224223
info.si_signo = sig;
225-
info.si_code = SI_QUEUE;
226224
info.si_pid = getpid();
227225
info.si_uid = getuid();
228226
info.si_value = value;

0 commit comments

Comments
 (0)