Hello everyone,

I'm trying to build a custom ramdisk using anthrax: https://github.com/posixninja/anthrax

The provided code includes an exec_cmd function which I give here:
Code:
void exec_cmd(char * argv[], char *env[]) {
        if(vfork() != 0) {
                while(wait4(-1, NULL, WNOHANG, NULL) <= 0) {
                        HANG_LIMIT(1000);
                }
        } else {
                execve(argv[0], argv, env);
        }
}
I would like to use this function call to execute any binary that I add onto the ramdisk. Here is the call added to launchd.c:

Code:
console_print("test: executing banner\n");
exec_cmd((char *[]){"/sbin/banner", (char *)0}, NULL);
/sbin/banner is just a binary that prints Hello World and exits.
The problem is I never see the output of it. When the ramdisk loads, I can see "test: executing banner", which comes from the console_print call just above, and nothing more.

What do I have to do to print the output of forked programs (stderr and stdout) to the console ?

FYI, I tried to compile my banner different ways:
either by linking it against libSystem and libgcc (which were added onto the ramdisk of course) :
Code:
gcc -std=c99 banner.c -o banner
or by only using the syscalls defined into anthrax's syscall.S file:
Code:
gcc -std=c99 banner.c syscall.S -static -o banner -nostdlib
Then I strip the banner binary, and pseudo-sign it with ldid -S.

Nothing works...

Can anyone help on this ? Thanks