This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 9 Oct 2017 10:11:43 -0000
- Subject: [newlib-cygwin] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5952d5f08f3200e7b7f65ef8568bfef9b4707940
commit 5952d5f08f3200e7b7f65ef8568bfef9b4707940
Author: Ken Brown <kbrown@cornell.edu>
Date: Sat Sep 16 22:04:18 2017 -0400
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
Fix all callers.
Diff:
---
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 fbd2b24..016fce1 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