hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 595d4ce723a21c348f82ac687d649890fb91f453
parent 616e2071a2419a6fb21591fa170bb14eeea51055
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed,  3 Nov 2021 10:46:03 +0100

os::exec: use O_EXEC on +freebsd

This does more or less the same thing as O_PATH for our purposes.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mos/exec/exec+freebsd.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/exec/exec+freebsd.ha b/os/exec/exec+freebsd.ha @@ -17,6 +17,7 @@ export fn fork() (int | void | error) = { }; fn open(path: str) (platform_cmd | error) = { + // TODO: This is racy, rewrite with TOCTOU match (rt::access(path, rt::X_OK)) { case err: rt::errno => return errors::errno(err); @@ -25,8 +26,7 @@ fn open(path: str) (platform_cmd | error) = { return errors::noaccess; }; }; - // XXX: FreeBSD does not support O_PATH - match (rt::open(path, rt::O_RDONLY, 0u)) { + match (rt::open(path, rt::O_EXEC, 0u)) { case fd: int => return fd; case err: rt::errno =>