5 #include "cvmfs_config.h"
19 const std::string &fqrn,
20 const std::string &path_hooks)
27 std::set<int> preserve_fildes;
28 preserve_fildes.insert(0);
29 preserve_fildes.insert(1);
30 preserve_fildes.insert(2);
31 std::map<int, int> map_fildes;
32 map_fildes[pipe_stdin[0]] = 0;
33 std::vector<std::string> cmd_line;
34 cmd_line.push_back(
"/bin/sh");
49 const std::string callout =
50 func +
"() { :; }\n" +
51 ". " + path_hooks +
"\n" +
52 func +
" " + fqrn +
"\n";
53 WritePipe(pipe_stdin[1], callout.data(), callout.length());
int CallServerHook(const std::string &func, const std::string &fqrn, const std::string &path_hooks="/etc/cvmfs/cvmfs_server_hooks.sh")
bool ManagedExec(const std::vector< std::string > &command_line, const std::set< int > &preserve_fildes, const std::map< int, int > &map_fildes, const bool drop_credentials, const bool clear_env, const bool double_fork, pid_t *child_pid)
int WaitForChild(pid_t pid, const std::vector< int > &sig_ok)
void MakePipe(int pipe_fd[2])
bool FileExists(const std::string &path)
void WritePipe(int fd, const void *buf, size_t nbyte)
void ClosePipe(int pipe_fd[2])