Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Oct 1998 22:30:47 -0700
From:      Mike Smith <mike@smith.net.au>
To:        Darren Whittaker <djw@sage1.sagecorp.com>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: problem in 3.0 
Message-ID:  <199810080530.WAA01135@dingo.cdrom.com>
In-Reply-To: Your message of "Wed, 07 Oct 1998 16:03:13 MDT." <Pine.SOL.3.93.981007155510.26034A-100000@sage1.sagecorp.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> We have found a problem with popen. The first popen is executed just fine
> with a good pclose. The second popen appears to work (though nothing
> happens) and the pclose returns a 138. This also applies to the system
> call. The first one works but any after sustem call after the first
> one fails. We even forked the process but in the child only the first
> popen work.

I'm not sure that I can follow your problem here.  Have you reduced the 
program to its simplest form, eg:

dingo:/tmp>cat p.c
#include <stdio.h>
#include <err.h>

void main(void) 
{
        int     i, j;
        char    buf[256];
        FILE    *p;

        for (i = 0; i < 10; i++) {
                if ((p = popen("/bin/date", "r")) == NULL)
                        err(1, "popen");
                fgets(buf, sizeof(buf) - 1, p);
                printf(buf);
                if ((j = pclose(p)) != 0)
                        errx(1, "pclose %d", j);
        }
}
dingo:/tmp>gcc -o p p.c
dingo:/tmp>./p
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
Wed Oct  7 22:28:04 PDT 1998
dingo:/tmp>uname -a
FreeBSD dingo.cdrom.com 3.0-CURRENT FreeBSD 3.0-CURRENT #2: Wed Sep 16 16:38:28 PDT 1998     mike@dingo.cdrom.com:/local0/src/sys/compile/DINGO  i386

What do you mean by "this also applies to the system call"?  Which 
system call?

>   Now our program is running as a cgi under Apache and works on your 2.x
> versions just fine.

I'm afraid you're going to have to supply some more detail before we 
can help you further here.
-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810080530.WAA01135>