about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/raise.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/raise.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/raise.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/raise.c b/nptl/sysdeps/unix/sysv/linux/raise.c
index 268ba87b29..ac54fa217e 100644
--- a/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -44,17 +44,19 @@ raise (sig)
 #endif
       THREAD_SETMEM (pd, tid, selftid);
 
+#if __ASSUME_TGKILL || defined __NR_tgkill
       /* We do not set the PID field in the TID here since we might be
 	 called from a signal handler while the thread executes fork.  */
       pid = selftid;
+#endif
     }
 #if __ASSUME_TGKILL || defined __NR_tgkill
   else
     /* raise is an async-safe function.  It could be called while the
        fork function temporarily invalidated the PID field.  Adjust for
        that.  */
-    if (__builtin_expect (pid < 0, 0))
-      pid = -pid;
+    if (__builtin_expect (pid <= 0, 0))
+      pid = pid == 0 ? selftid : -pid;
 #endif
 
 #if __ASSUME_TGKILL