开发者

insert unknown command to execvp()

开发者 https://www.devze.com 2023-02-28 13:56 出处:网络
hi if i开发者_运维问答\'m passing an unknown command to execvp i\'m getting this error in the errno :

hi if i开发者_运维问答'm passing an unknown command to execvp i'm getting this error in the errno : "no such file or directory" when i should get this error: "command not found"

how can i get the second error?


Because "command not found" does not correspond to a standard error code (see e.g. http://linux.die.net/man/3/errno).


There is no "command not found" error that can be returned from execvp. The closest is ENOENT, which means that the file specified (or its interpreter, or a required dynamic library) was not found.

If you want, your program could print out "command not found" rather than the text returned by strerror.

0

精彩评论

暂无评论...
验证码 换一张
取 消