I'm unable to execute the command alone, with arguments is working. How can I make it work both ways.
char command[256];
char args[10][256];
char buffer[256] __attribute__((aligned(4096)));
Funcion is handling command and arguments and I'm sure they are correct, however I can't find a way to execute it.
pid = fork();
if (pid == -1)
{
printf("Failed forming fork\n");
return;
}
else if (pid == 0)
{
strcpy( cmd , "/usr/bin/");
strcat( cmd, command);
execl(cmd, command, args, NULL);
}else{
wait(NULL);
}
And in general how can I stop fork bombs, how to check for them and avoid them?