Launching Executable In C++
I wish to launch an executable by API call, but I am not sure if one is supposed to check for executable bit using posix APIs before hand. What is best practice in this regard?
Answer
All Posix APIs you'll use to launch a process (e.g. execve()
and friends) will do any and all required filesystem permissions checks in a context that is atomic and secure (and doing so in user space is neither). Best practice is to simply use the syscalls that are available.
As a side note, you can browse the source code of all kinds of tools that invoke the standard fork
/exec
team you're talking about. For example GNU make. I'm sure there are exceptions somewhere in the wild, but practically speaking I've never seen real software attempt to validate filesystem permissions in user space before calling exec()
.
Related Questions
- → Comparing two large files are taking over four hours
- → Setting JSON node name to variable value
- → Compiling GLUT using Emscripten
- → Evaluate check box from a scanned image in node.js
- → Find an easy web server framework for mobile game
- → my https C++ code doesn't work on some sites (binance)
- → Error while opening pivx wallet on ubuntu
- → Why sending a POST by AJAX is interpreted by the HTTP Server as OPTIONS and sending by CURL is effectively a PUT?
- → Python reading in one line multiple types for a calculator
- → How do I properly pass an argument to a function
- → Accessing Websql database with Qt
- → Using Mysql C API for c++ codes
- → How do I set constants at run-time in a c++ header file, imported through Cython?