[torquedev] Very suspicious code

"Mgr. Šimon Tóth" SimonT at mail.muni.cz
Mon Sep 6 05:41:01 MDT 2010


I'm just hacking my way through some old code. I stumbled upon a very
odd code. I'm not exactly sure if its a bug, but it definitely looks
very odd and I'm pretty sure that it can lead to some very odd behaviour.

The fork_to_user function does exactly what its name suggest, the weird
thing is the error handling in req_cpyfile and req_delfile.

req_cpyfile() reacts to all errors except PBSE_SYSTEM and PBSE_BADUSER
with exit (thats ok, when the error is in child, exit should be called),
all other are handled by a return, while req_delfile() reacts to all
with return.

Looking at the code of fork_to_user, what I think can happen is that
there will be a hanging process when the PBSE_SYSTEM or PBSE_BADUSER is
returned by the forked child (can happen), or when any error is returned
by the forked child in req_delfile().

-- 
Mgr. Šimon Tóth

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3366 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.supercluster.org/pipermail/torquedev/attachments/20100906/ef4526c9/attachment.bin 


More information about the torquedev mailing list