delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/15/11:14:56

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 15 Sep 2005 08:14:40 -0700 (PDT)
From: Eduardo Chappa <chappa AT math DOT washington DOT edu>
To: cygwin AT cygwin DOT com
Subject: problem with getppid()
Message-ID: <Pine.LNX.4.63.0509150809440.23407@zeno1.math.washington.edu>
MIME-Version: 1.0
X-Antivirus: Scanned by Vexira Antivirus 1.1.1
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019