aboutsummaryrefslogtreecommitdiffstats
path: root/liblfjail/path.hh
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-06-13 11:33:41 +0100
committerLexi Winter <ivy@FreeBSD.org>2025-06-15 18:53:58 +0100
commit13d33ca246fa07d4778deb88ccde1d347bcc6c07 (patch)
treed385ca4fbe9bb95bde288f7799dbab1be4e1e05e /liblfjail/path.hh
parent722c03e547a1370857878ea7db27be6111aae8b1 (diff)
downloadlfjail-13d33ca246fa07d4778deb88ccde1d347bcc6c07.tar.gz
lfjail-13d33ca246fa07d4778deb88ccde1d347bcc6c07.tar.bz2
updates
Diffstat (limited to 'liblfjail/path.hh')
-rw-r--r--liblfjail/path.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/liblfjail/path.hh b/liblfjail/path.hh
new file mode 100644
index 0000000..b7a4dcf
--- /dev/null
+++ b/liblfjail/path.hh
@@ -0,0 +1,25 @@
+/*
+ * This source code is released into the public domain.
+ */
+
+#ifndef LFJAIL_PATH_HH
+#define LFJAIL_PATH_HH
+
+#include <optional>
+#include <string>
+
+#include "fd.hh"
+
+namespace lfjail {
+
+/*
+ * Find an executable in $PATH. If $PATH is not set, use _PATH_DEFPATH
+ * from <paths.h>. An empty path element is treated as ".".
+ *
+ * If the file is found, open it using O_EXEC and return the fd.
+ */
+auto find_in_path(std::string const &file) -> std::optional<fd>;
+
+} // namespace lfjail
+
+#endif // !LFJAIL_PATH_HH