diff --git a/libifupdown/execute.c b/libifupdown/execute.c index d5b7bda..69af1c0 100644 --- a/libifupdown/execute.c +++ b/libifupdown/execute.c @@ -140,10 +140,10 @@ lif_file_is_executable(const char *path) } bool -lif_maybe_run_executor(const struct lif_execute_opts *opts, char *const envp[], const char *executor, const char *phase) +lif_maybe_run_executor(const struct lif_execute_opts *opts, char *const envp[], const char *executor, const char *phase, const char *lifname) { if (opts->verbose) - fprintf(stderr, "ifupdown: attempting to run %s executor for phase %s\n", executor, phase); + fprintf(stderr, "ifupdown: %s: attempting to run %s executor for phase %s\n", lifname, executor, phase); char pathbuf[4096]; @@ -156,10 +156,10 @@ lif_maybe_run_executor(const struct lif_execute_opts *opts, char *const envp[], } bool -lif_maybe_run_executor_with_result(const struct lif_execute_opts *opts, char *const envp[], const char *executor, char *buf, size_t bufsize, const char *phase) +lif_maybe_run_executor_with_result(const struct lif_execute_opts *opts, char *const envp[], const char *executor, char *buf, size_t bufsize, const char *phase, const char *lifname) { if (opts->verbose) - fprintf(stderr, "ifupdown: attempting to run %s executor for phase %s\n", executor, phase); + fprintf(stderr, "ifupdown: %s: attempting to run %s executor for phase %s\n", lifname, executor, phase); char pathbuf[4096]; diff --git a/libifupdown/execute.h b/libifupdown/execute.h index 89b9815..5a871a9 100644 --- a/libifupdown/execute.h +++ b/libifupdown/execute.h @@ -32,7 +32,7 @@ struct lif_execute_opts { extern bool lif_execute_fmt(const struct lif_execute_opts *opts, char *const envp[], const char *fmt, ...); extern bool lif_execute_fmt_with_result(const struct lif_execute_opts *opts, char *buf, size_t bufsize, char *const envp[], const char *fmt, ...); extern bool lif_file_is_executable(const char *path); -extern bool lif_maybe_run_executor(const struct lif_execute_opts *opts, char *const envp[], const char *executor, const char *phase); -extern bool lif_maybe_run_executor_with_result(const struct lif_execute_opts *opts, char *const envp[], const char *executor, char *buf, size_t bufsize, const char *phase); +extern bool lif_maybe_run_executor(const struct lif_execute_opts *opts, char *const envp[], const char *executor, const char *phase, const char *lifname); +extern bool lif_maybe_run_executor_with_result(const struct lif_execute_opts *opts, char *const envp[], const char *executor, char *buf, size_t bufsize, const char *phase, const char *lifname); #endif diff --git a/libifupdown/lifecycle.c b/libifupdown/lifecycle.c index 19982bb..96c895b 100644 --- a/libifupdown/lifecycle.c +++ b/libifupdown/lifecycle.c @@ -47,13 +47,13 @@ handle_commands_for_phase(const struct lif_execute_opts *opts, char *const envp[ } static inline bool -handle_single_executor_for_phase(const struct lif_dict_entry *entry, const struct lif_execute_opts *opts, char *const envp[], const char *phase) +handle_single_executor_for_phase(const struct lif_dict_entry *entry, const struct lif_execute_opts *opts, char *const envp[], const char *phase, const char *lifname) { if (strcmp(entry->key, "use")) return true; const char *cmd = entry->data; - if (!lif_maybe_run_executor(opts, envp, cmd, phase)) + if (!lif_maybe_run_executor(opts, envp, cmd, phase, lifname)) return false; return true; @@ -67,12 +67,12 @@ handle_executors_for_phase(const struct lif_execute_opts *opts, char *const envp if (up) { LIF_DICT_FOREACH(iter, &iface->vars) - handle_single_executor_for_phase(iter->data, opts, envp, phase); + handle_single_executor_for_phase(iter->data, opts, envp, phase, iface->ifname); } else { LIF_DICT_FOREACH_REVERSE(iter, &iface->vars) - handle_single_executor_for_phase(iter->data, opts, envp, phase); + handle_single_executor_for_phase(iter->data, opts, envp, phase, iface->ifname); } return true; @@ -97,7 +97,7 @@ query_dependents_from_executors(const struct lif_execute_opts *opts, char *const continue; const char *cmd = entry->data; - if (!lif_maybe_run_executor_with_result(&exec_opts, envp, cmd, resbuf, sizeof resbuf, phase)) + if (!lif_maybe_run_executor_with_result(&exec_opts, envp, cmd, resbuf, sizeof resbuf, phase, iface->ifname)) return false; if (!*resbuf)