If we call pid2tcb with 0 as argument, the function will
return the first tcp with flag TCB_INUSE, which will cause
problems if we call wait with pgrp id 0 on linux.

* strace.c (pid2tcb): Return NULL if argument is process
  group id on linux.
---
 strace.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/strace.c b/strace.c
index 3cb3758..77ae7e9 100644
--- a/strace.c
+++ b/strace.c
@@ -1343,6 +1343,11 @@ int pid;
        int i;
        struct tcb *tcp;
 
+#ifndef USE_PROCFS
+       if (pid == 0 || pid < -1)
+               return NULL;
+#endif
+
        for (i = 0; i < tcbtabsize; i++) {
                tcp = tcbtab[i];
                if (pid && tcp->pid != pid)
-- 
1.6.5.2


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to