if (forkpid == 0) {
const char * working_dir_c = nullptr;
if (! working_dir.empty()) working_dir_c = working_dir.c_str();
- if (after_fork(getpid())) {
- run_child_proc(cmd.data(), working_dir_c, logfile, on_console, pipefd[1], control_socket[1],
+ after_fork(getpid());
+ run_child_proc(cmd.data(), working_dir_c, logfile, on_console, pipefd[1], control_socket[1],
socket_fd, notify_pipe[1], force_notification_fd, nullptr, run_as_uid, run_as_gid);
- }
- else {
- int exec_status = errno;
- write(pipefd[1], &exec_status, sizeof(int));
- _exit(0);
- }
}
else {
// Parent process
// Start the process, return true on success
virtual bool bring_up() noexcept override;
- // Called after forking (before executing remote process). Returns true to continue
- // execution, otherwise sets errno and returns false.
- virtual bool after_fork(pid_t child_pid) noexcept { return true; }
+ // Called after forking (before executing remote process).
+ virtual void after_fork(pid_t child_pid) noexcept { }
// Called when the process exits. The exit_status is the status value yielded by
// the "wait" system call.
char inittab_line[sizeof(utmpx().ut_line)];
protected:
- bool after_fork(pid_t child_pid) noexcept override
+ void after_fork(pid_t child_pid) noexcept override
{
if (*inittab_id || *inittab_line) {
- return create_utmp_entry(inittab_id, inittab_line, child_pid);
+ create_utmp_entry(inittab_id, inittab_line, child_pid);
}
- return true;
}
#endif