我正在尝试将应用程序从 OpenVMS 移植到 Linux。应用程序通过以下方式创建子流程:
if ((pid = fork()) == 0)
{
// do subprocess
}
else if (pid < 0)
{
printf("\ncreation of subprocess failed") ;
}
else
{
wait(pid) ;
}
现在编译器(gcc)给了我一个警告,永远不会达到'pid < 0'的情况。但是为什么,以及如何在 fork() 中发现问题?
非常感谢您的帮助
约尔格