Blog
When Linux sucks, it sucks more than anything else.
Date: 14/10/2003
Did you know that popen wasn't thread safe?

Yeah well it ain't. So those nice little 3 liners (popen, fgets, pclose) now turn into a pipe, fork, dup, close, exec, waitpid, hndstate mess. Of course put it in a function and forget about it.

But why? Why not fix the function! It's not the '90s anymore people, where Linux is just for uni students with too much time on their hands.

Btw gdb 6.0 is out. And it fails nicely when you call fork in a program linked to pthreads (not even calling pthreads yet). However with gdb 5.3 you can call fork, exec etc and it all works but popen is still poison.

So now I have the joy of hunting through LGI and removing all calls to popen so that things "Just Work (tm)".
 
Reply
From:
Email (optional): (Will be HTML encoded to evade harvesting)
Message:
 
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.
BBcode:
[q]text[/q]
[url=link]description[/url]
[img]url_to_image[/img]
[pre]some_code[/pre]
[b]bold_text[/b]