A bit of Super Searching found ...
- Timeout with SIG{ALRM} not working as expected
- Random Walk's note at the bottom may hold the key.
- Re^5: Splitting one large timeout into few smaller ones..
- Roy Johnson has some code you can steal/adapt.
- Timeout on system command
- Looks like a similar problem ... and even has links to more nodes on the problem
- system() with timeout
- Again, similar problem - with some sage advice
Hope these help. For the record, I searched on "fork kill alarm".