Assuming your ultimate goal is to ultimately run the program, you will not. This test would be useless because the result is potentially incorrect even before the function returns the test! You should be prepared to handle execve crashes due to permission errors.
As Steve Jessop pointed out, checking if the executable is given can be useful in some situations, for example, in the file list ( ls -l ) or the visual file manager. Of course, one could think of more esoteric uses, such as using file permission bits for interprocess communication (interesting as a method that does not require resource allocation), but I suspect stat ("What permission bits are set to?"), And not access ("Does the calling process have X permission?") is likely to be an interesting question ...
source share