summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-01-31 15:22:59 +0100
committerThomas Haller <thaller@redhat.com>2015-06-19 12:05:50 +0200
commit517e9fa0f062e286f893f41770d0562c4baf0c51 (patch)
tree9f5bdd810d40e5f9587cbb03fbae887d74a290f9
parent060f7a463e477dbad2fa84d8c52a4ce859ab802d (diff)
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 205c109741b822e9475994b74232b6bf64d4f16d)
-rw-r--r--src/settings/plugins/ibft/reader.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/settings/plugins/ibft/reader.c b/src/settings/plugins/ibft/reader.c
index ccf84372e6..833818c876 100644
--- a/src/settings/plugins/ibft/reader.c
+++ b/src/settings/plugins/ibft/reader.c
@@ -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)");