This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem with getppid()


Hello,

I have a problem runing the following program "test.c"

------
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

main()
{
  int p;

  if((p = getppid()) == 1)
    printf("My parent is bad, ppid=%d\n", p);
  else
    printf("My parent is good, ppid=%d\n", p);

  exit(0);
}
--------

I build the program with the command

gcc -g -o test test.c

The problem is the following. When I execute the program in the command line

./test

I get the output: "My parent is good", but if I execute the same program under gdb

gdb ./test
(gdb) run

The output is "My parent is bad". I believe this is a bug in Cygwin's implementation of getppid().

Could someone please confirm this. Hopefully it is easy to fix.

Thank you.

--
Eduardo
http://www.math.washington.edu/~chappa/pine/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]