NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/55836: popen(3)'s type "r+" doesn't work correctly



Hi,

Thank you for your input.  According to the man pages "the command's standard input is the same as that of the process that called popen()".

As rvp said the man page could stand some improvement.

Okay, if you don't trust this, try that after the pipe is opened:

     fputs("abcdefg\n", fp);

fgets(buf, sizeof(buf), fp) returns this string but after that it hangs, no NULL will be returned.

Of course not.  Since the stdin of cat isn't closed, cat still sits
there waiting for more input, which it would copy to its stdout.
And since your programm could still read some data from fp,
it still waits for more input from that.  In order to get what you
are trying to achieve, you'd somehow make cat terminate.
E.g., you could kill the cat (ha!) or to shutdown(2) the output
side of fp (untested!)

Ciao,
Wolfgang
--
Wolfgang%Solfrank.net@localhost				Wolfgang Solfrank


Home | Main Index | Thread Index | Old Index