A small detail, why do you check if the root_fd is valid? Eg.
...
if (G.root_fd >= 0) {
...
It shouldn't be possible for it to be invalid and the old code didn't validate it either.
--
This message has been scanned for viruses and dangerous content by CronLab
(www.cronlab.com), and is believed to be clean.