26: execve(prog[0],prog,env);
27: return 0;
execve() does not return on success, and the text, data, bss, and
stack of the calling process are overwritten by that of the program
loaded.
是return 0;
为了什么?
26: execve(prog[0],prog,env);
27: return 0;
execve() does not return on success, and the text, data, bss, and
stack of the calling process are overwritten by that of the program
loaded.
是return 0;
为了什么?
我建议停止这个编译器警告。
$ cat | gcc -W -Wall -x c -
int main(){}
^D
<stdin>: In function 'main':
<stdin>:1:1: warning: control reaches end of non-void function
这也将使静态分析器和 IDE 对同一事物发出快乐的警告。
那条线以防万一execve()
失败并返回。从理论上讲,它永远不应该发生,但有时会发生。通常,返回值设置为某个随机数以表示存在错误。