aboutsummaryrefslogtreecommitdiffstats
path: root/liblfjail/path.hh
blob: b7a4dcf73aea10a8c80f91998e33efa0b46c31f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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