aboutsummaryrefslogtreecommitdiff
path: root/nptl/init.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-04-08 20:28:00 +0000
committerUlrich Drepper <drepper@redhat.com>2006-04-08 20:28:00 +0000
commit7960f2a7040874c63196657fa25d6ddda778cc67 (patch)
tree7acbee73ed0428e433ee26dfd78ca5d6aa1512ee /nptl/init.c
parent0a21e40021389dd9beccafae597fd931e355f7cd (diff)
downloadglibc-7960f2a7040874c63196657fa25d6ddda778cc67.zip
glibc-7960f2a7040874c63196657fa25d6ddda778cc67.tar.gz
glibc-7960f2a7040874c63196657fa25d6ddda778cc67.tar.bz2
* nis/nis_ping.c: Remove unnecessary conditionals before
nis_freeresult calls. * nis/nis_ismember.c: Likewise.
Diffstat (limited to 'nptl/init.c')
-rw-r--r--nptl/init.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/nptl/init.c b/nptl/init.c
index 4db3e0c..7cfe803 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -148,6 +148,14 @@ static const struct pthread_functions pthread_functions =
static void
sigcancel_handler (int sig, siginfo_t *si, void *ctx)
{
+#ifdef __ASSUME_CORRECT_SI_PID
+ /* Determine the process ID. It might be negative if the thread is
+ in the middle of a fork() call. */
+ pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
+ if (__builtin_expect (pid < 0, 0))
+ pid = -pid;
+#endif
+
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
@@ -156,7 +164,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
#ifdef __ASSUME_CORRECT_SI_PID
/* Kernels before 2.5.75 stored the thread ID and not the process
ID in si_pid so we skip this test. */
- || si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
+ || si->si_pid != pid
#endif
|| si->si_code != SI_TKILL)
return;
@@ -201,6 +209,14 @@ struct xid_command *__xidcmd attribute_hidden;
static void
sighandler_setxid (int sig, siginfo_t *si, void *ctx)
{
+#ifdef __ASSUME_CORRECT_SI_PID
+ /* Determine the process ID. It might be negative if the thread is
+ in the middle of a fork() call. */
+ pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
+ if (__builtin_expect (pid < 0, 0))
+ pid = -pid;
+#endif
+
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
@@ -209,7 +225,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
#ifdef __ASSUME_CORRECT_SI_PID
/* Kernels before 2.5.75 stored the thread ID and not the process
ID in si_pid so we skip this test. */
- || si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
+ || si->si_pid != pid
#endif
|| si->si_code != SI_TKILL)
return;