mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-08 14:42:02 +00:00
sys: Use run_command() to print messages to the journal
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
@@ -221,3 +221,12 @@ bool file_is_executable(const char *filename)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void journal_log_error(const char *message)
|
||||
{
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
run_command_quiet("/usr/bin/systemd-cat", "--identifier=swupd", "--priority=err", "/bin/echo", message, NULL);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,11 @@ bool file_exits(const char *filename);
|
||||
*/
|
||||
bool file_is_executable(const char *filename);
|
||||
|
||||
/*
|
||||
* Print error 'message' to system journal.
|
||||
*/
|
||||
void journal_log_error(const char *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-8
@@ -315,7 +315,6 @@ struct manifest *load_mom(int version, bool latest, bool mix_exists, int *err)
|
||||
int ret = 0;
|
||||
char *filename;
|
||||
char *url;
|
||||
char *log_cmd = NULL;
|
||||
bool retried = false;
|
||||
bool perform_sig_verify = !(migrate && mix_exists);
|
||||
bool invalid_sig = false;
|
||||
@@ -376,13 +375,7 @@ retry_load:
|
||||
}
|
||||
warn("FAILED TO VERIFY SIGNATURE OF Manifest.MoM. Operation proceeding due to\n"
|
||||
" --nosigcheck, but system security may be compromised\n");
|
||||
string_or_die(&log_cmd, "echo \"swupd security notice:"
|
||||
" --nosigcheck used to bypass MoM signature verification failure\" | /usr/bin/systemd-cat --priority=\"err\" --identifier=\"swupd\"");
|
||||
if (system(log_cmd)) {
|
||||
/* useless noise to suppress gcc & glibc conspiring
|
||||
* to make us check the result of system */
|
||||
}
|
||||
free_string(&log_cmd);
|
||||
journal_log_error("swupd security notice: --nosigcheck used to bypass MoM signature verification failure");
|
||||
}
|
||||
/* Make a copy of the Manifest for the completion code */
|
||||
if (latest) {
|
||||
|
||||
Reference in New Issue
Block a user