Skip to content

Commit

Permalink
mxqd: Simplify reexec
Browse files Browse the repository at this point in the history
Currently argv is converted to a string and back to an array before mxqd
reexecs itself. Use the original argv instead.

Difference is, that options are not included in the informational
messages.
  • Loading branch information
donald committed Feb 21, 2022
1 parent 3f2fe00 commit c45a22e
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2874,27 +2874,12 @@ int main(int argc, char *argv[])
server_close(server);

while (global_sigrestart_cnt) {
_mx_cleanup_free_ char *saved_argv_str = NULL;
char **saved_argv;

saved_argv_str = mx_strvec_to_str(argv);

mx_log_info("Reexecuting mxqd... ");

saved_argv = mx_strvec_from_str(saved_argv_str);
if (!saved_argv) {
mx_log_fatal("Can't recaculate commandline. str_to_strvev(%s) failed: %m", saved_argv_str);
break;
}

mx_log_info("-------------------------------------------------------------");
mx_log_info(" Reexecuting %s", saved_argv_str);
mx_log_info(" Reexecuting %s", argv[0]);
mx_log_info("-------------------------------------------------------------");

res = execvp(saved_argv[0], saved_argv);
mx_log_fatal("execvp(\"%s\", ...): %m", saved_argv[0]);
res = execvp(argv[0], argv);
mx_log_fatal("execvp(\"%s\", ...): %m", argv[0]);
break;

}

mx_log_info("cu, mx.");
Expand Down

0 comments on commit c45a22e

Please sign in to comment.