mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-15 02:10:32 +01:00
ibft: avoid logging multiple lines when ibft fails
In case of error, ibft prints an error message to stderr
with two trailing newlines. This causes multiple lines
in our logfile. Replace newlines in the error message
by whitespaces.
(cherry picked from commit 205c109741)
This commit is contained in:
parent
060f7a463e
commit
517e9fa0f0
1 changed files with 9 additions and 0 deletions
|
|
@ -136,6 +136,15 @@ read_ibft_blocks (const char *iscsiadm_path,
|
|||
}
|
||||
|
||||
if (WEXITSTATUS (status) != 0) {
|
||||
if (err) {
|
||||
char *nl;
|
||||
|
||||
/* the error message contains newlines. concatenate the lines with whitespace */
|
||||
for (nl = err; *nl; nl++) {
|
||||
if (*nl == '\n')
|
||||
*nl = ' ';
|
||||
}
|
||||
}
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
"iBFT: %s exited with error %d. Message: '%s'",
|
||||
iscsiadm_path, WEXITSTATUS (status), err ? err : "(none)");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue