Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!warwick!cstaqgx From: cstaqgx@cu.warwick.ac.uk (RouE) Newsgroups: comp.unix.programmer Subject: popen() Message-ID: Date: 9 Mar 91 19:14:59 GMT Sender: news@warwick.ac.uk (Network news) Distribution: comp Organization: Computing Services, Warwick University, UK Lines: 43 Originator: cstaqgx@lily Nntp-Posting-Host: lily I'm having trouble with popen(). In particular I am trying to do FILE *pp; char lineread[80]; pp = popen("rlogin lily","r+"); while (1) while (!feof(pp)) { fgets(lineread,80,pp); fprintf(stderr,lineread); } This works fine if I run this as is, but if I do main() { if (fork()) exit(0); signal(SIGHUP,SIG_IGN); signal(SIGQUIT,SIG_IGN); signal(SIGINT,SIG_IGN); . . . at the beginning, then I get a seg. fault when fgets tries to read from the pipe. I've changed the command to "cat /usr/dict/words" and it works fine in the background, so I reckon it's something to do with doing a pipe to rlogin. Does anyone have any idea what is wrong, and what can be done about it? thanks, RouX -- Jason L Saunders [ alias RouXiaN (RouX) - ex-RouE, now XiaN ] email: cstaqgx@uk.ac.warwick.cu or roue@uk.ac.warwick.cs snail: Mathematics Institute, University of Warwick, Coventry CV4 7AL, UK "You can't learn to swim in the lake of fire" -- Jason L Saunders [ alias RouXiaN (RouX) - ex-RouE, now XiaN ] email: cstaqgx@uk.ac.warwick.cu or roue@uk.ac.warwick.cs snail: Mathematics Institute, University of Warwick, Coventry CV4 7AL, UK "You can't learn to swim in the lake of fire"