File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed
Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,32 @@ static std::string safe_run_init64_cmd_wrapper(
6565 const char * str_root_key,
6666 const char *cmd,
6767 ssize_t & out_err) {
68- pid_t target_pid = 1 ;
69- return safe_inject_process64_run_cmd_wrapper (str_root_key, target_pid,
70- cmd, out_err);
68+ std::string str_cmd_result;
69+ if (cmd == NULL || strlen (cmd) == 0 ) { return {}; }
70+
71+ fork_pipe_info finfo;
72+ if (fork_pipe_child_process (finfo)) {
73+ out_err = 0 ;
74+ str_cmd_result = run_init64_cmd_wrapper (
75+ str_root_key,
76+ cmd,
77+ out_err);
78+ write_errcode_to_father (finfo, out_err);
79+ write_string_to_father (finfo, str_cmd_result);
80+ _exit (0 );
81+ return {};
82+ }
83+
84+ out_err = 0 ;
85+ if (!wait_fork_child_process (finfo)) {
86+ out_err = -64001 ;
87+ } else {
88+ if (!read_errcode_from_child (finfo, out_err)) {
89+ out_err = -64002 ;
90+ } else if (!read_string_from_child (finfo, str_cmd_result)) {
91+ out_err = -64003 ;
92+ }
93+ }
94+ return str_cmd_result;
7195}
7296#endif /* INIT64_HELPER_H_ */
You can’t perform that action at this time.
0 commit comments