3 ms·
Oh yeah, I've once discovered this method myself. With execveat() one can even avoid going through procfs. It doesn't work worth shbang-based scripts, though;
by pwdisswordfish2 7y ago
Oh yeah, I've once discovered this method myself. With execveat() one can even avoid going through procfs.
It doesn't work worth shbang-based scripts, though; that just returns ENOENT. Makes sense, I suppose.
- GrayShade 7y agoThere's also fexecve().
- ifoundthetao 7y agoWould you be willing to share how you did that (avoiding procfs too)?
- pwdisswordfish2 7y agoInstead of snprintf(pathbuf, sizeof(pathbuf), "/proc/self/fd/%u", fd); execve(pathbuf, argv, envp); you do execveat(fd, "", argv, envp, AT_EMPTY_PATH); and that's it.
- ifoundthetao 7y agoThanks!!