diff options
author | Thomas Haller <thaller@redhat.com> | 2015-01-31 15:22:59 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-02-03 12:58:23 +0100 |
commit | 205c109741b822e9475994b74232b6bf64d4f16d (patch) | |
tree | 72288f7ac93c00d992f3448283ee171586cd3ec3 | |
parent | 58038547617f8d10270b858666e2aa9a236ec0d2 (diff) | |
download | NetworkManager-205c109741b822e9475994b74232b6bf64d4f16d.tar.gz |
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.
-rw-r--r-- | src/settings/plugins/ibft/reader.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/settings/plugins/ibft/reader.c b/src/settings/plugins/ibft/reader.c index 0d77871f42..bcbfa33002 100644 --- a/src/settings/plugins/ibft/reader.c +++ b/src/settings/plugins/ibft/reader.c @@ -119,6 +119,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)"); |