News for hackers. Stuff that matters.
Re:fork() can fail by Alupis on Wednesday August 20, 2014 @04:52PM (#8204545)
True -- I guess fork() has failed at that point. I was more getting at the article's authors scenarios of careless scripts treating -1 as a valid pid (which should always be > 0), which would be a failure of the script instead.
Re:fork() can fail by dllthomas on Wednesday August 20, 2014 @04:57PM (#8204566)
Well, it's a failure of the script and the POSIX API - it is unfortunate that a pid_t inhabited by -1 means "failure" in one case and "everything" in another. It is certainly not fork, narrowly, to blame.
Re:fork() can fail by M00n_Sl47r on Wednesday August 20, 2014 @06:05PM (#8204931)
I think the point that the author was making, outside of any criticism to the API itself, is that the hapless programmer may not know that fork() could even return -1. The article is pointing out that possibility as documented by the API, not criticizing a failure of the API. Whether or not the API is faulty in this--and I tend to agree with you--is outside of the scope of the article, though only just.
Re:fork() can fail by dllthomas on Wednesday August 20, 2014 @07:49PM (#8205290)
I wasn't making any particular comment on the content of the article. It was certainly relevant to the discussion tangent the thread had wandered down.