This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH 10/12] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-patches at cygwin dot com
- Date: Sat, 16 Sep 2017 22:04:18 -0400
- Subject: [PATCH 10/12] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
- Authentication-results: sourceware.org; auth=none
- References: <20170917020420.10488-1-kbrown@cornell.edu>
Fix all callers.
---
winsup/cygwin/signal.cc | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index fbd2b241e..016fce1de 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -260,7 +260,7 @@ _pinfo::kill (siginfo_t& si)
}
this_pid = pid;
}
- else if (this && process_state == PID_EXITED)
+ else if (process_state == PID_EXITED)
{
this_process_state = process_state;
this_pid = pid;
@@ -296,8 +296,17 @@ kill0 (pid_t pid, siginfo_t& si)
syscall_printf ("signal %d out of range", si.si_signo);
return -1;
}
-
- return (pid > 0) ? pinfo (pid)->kill (si) : kill_pgrp (-pid, si);
+ if (pid > 0)
+ {
+ pinfo p (pid);
+ if (!p)
+ {
+ set_errno (ESRCH);
+ return -1;
+ }
+ return p->kill (si);
+ }
+ return kill_pgrp (-pid, si);
}
int
--
2.14.1