I've not compiled it yet, but I noticed that you are passing /bin/sh %s to system(3). But system itself is already a wrapper around exec that adds /bin/sh -c

So you end up forking off, execing a shell that runs a shell, that possibly runs a shell as well (because of the missing -c?), that runs the script. At least as far I can tell you at least want to drop the /bin/sh there and preferable switch to using

execv("/bin/sh", {"/bin/sh", "-c", "/etc/preinit.d/%s", NULL});
_________________________
40GB - serial #40104051 gpsapp