A C source code (compiled and running Linux Centos 6.3) has the line:
execve(cmd, argv, envp);
execve does not return, but I w
for this question: "is anything wrong with the above??"
and regarding this code:
if (child = fork()) {
waitpid(child, NULL, 0);
/*now I know execve is finished*/
exit(0);
}
execve(cmd, argv, envp);
the fork() function has three kinds of returned value:
-1 means an error occurred=0 means fork() was successful and the child process is running>0 means fork() was successful and the parent process is runningexecvp() needs to be followed (for the rare case of the call failing) with
perror( "execvp failed" );
exit( EXIT_FAILURE );
fork() returns a pid_t. After the call, the code needs to be similar to: (using child as the pid variable)
if( 0 > child )
{
perror( "fork failed");
exit( EXIT_FAILURE );
}
else if( 0 == child )
{ // then child process
execve(cmd, argv, envp);
perror( "execvp failed" );
exit( EXIT_FAILURE );
}
//else
//{ // else parent process
waitpid(child, NULL, 0);
exit( EXIT_SUCCESS );
for your second question, about the error message:
cc1: error: unrecognized command line option "-mfentry"
the word: unrecognized is mis-spelled, so this is not the actual error message.
This error message is not related to your question about the changes you made to dash.
However, the dash does not directly invoke any compile operations, so I suspect the questions are totally unrelated.
Suggest looking at the makefile for the biosutility utility for why there is a invalid parameter being passed to cc1.