popen / pclose - Solaris
On Solaris 6, 8, 9:
#include <stdio.h>
main()
{
FILE *fp = popen("/bin/ls", "r");
while (fgetc(fp) != -1)
;
pclose(fp);
perror("");
}
bash-2.03$ cc test.c
bash-2.03$ ./a.out
Illegal seek
bash-2.03$
Whathafakisthat??
Trackback URL: http://blogs.sun.com/motor/entry/popen_pclose_solaris
Posted by motor on mars 30, 2007 at 02:25 PD PDT #
Actually, you should only call perror if the pclose actually failed:
http://www.opengroup.org/onlinepubs/009695399/functions/errno.html
"The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified."
Posted by Dan Nelson on mars 30, 2007 at 09:55 PD PDT #
Posted by motor on prill 12, 2007 at 09:10 MD PDT #
Posted by auction car insurance salvage on qershor 11, 2007 at 12:39 MD PDT #