Hallo,
I've just played aroudn with the popen(2)-call. After getting a
segmentation fault on a quite old OpenBSD 3.8 machine I've tried to
understand the source.
/usr/src/lib/libc/gen/popen.c
what I am missing is the initialization of *pidlist. If I initialize
this static pointer with NULL everything seems to work fine.
Did I missunderstand the source or the usage of popen??
Thanks for Comments
Dag
The simple test programm (which dies only on ONE machine):
#include <stdio.h>
#include <stdlib.h>
FILE *p;
int main(void)
{
if(NULL == (p = popen("/bin/cat", "w")))
{
printf("popen() failed\n");
exit(1);
}
fprintf(p, "hallo to pipe\n");
printf("pclose exiting with %d\n", pclose(p));
return(0);
}