[torquedev] pbm_mom segfault in TMomCheckJobChild

Joshua Bernstein jbernstein at penguincomputing.com
Wed Dec 17 16:15:05 MST 2008

Garrick Staples wrote:
> After investigating both patches yesterday, I have to conclude that neither is
> of merit.  The close_conn() should never do the right thing, and the usage of
> '&&' in this context is perfectly valid.

Fair enough. But why is close(i) used there, when apparently in the 
2.4.0, its been corrected to close_conn()? Further close_conn() is used 
elsewhere in many other similar functions, thus it seems like a valid fix.

The second patch isn't really about the ordering of the if test. Its 
about that fact that errno is assigned to a variable even if the 
previous call to read() succeeded. While the man page, the GNU spec, and 
even the POSIX spec all talk about setting errno upon an actual error, 
it does not say that errno is set to 0 upon success.


Further, a problem with POSIX 1003.1 specification is the lack of a no 
error, errno value.

/* END RANT */

Even if you disagree with me, the fact remains that simply setting errno 
  to 0 upon entrance to the function, resolves the issue with the 
segfault. Given that, I can't think of any other explanation.

But I could be wrong of course. ;-)

-Joshua Bernstein
Software Engineer
Penguin Computing

More information about the torquedev mailing list