aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-01-20 12:35:10 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-01-20 12:35:10 +0000
commit6ffefe7ff785b3abb990b6300023f8eafc790127 (patch)
tree1deac4ae455cca788ce1c66943996eeeeb696409
parent28f5e970a69f0be05d08eb81bdc72ab35b591dd7 (diff)
parent0d6b50d474090b9085c595e2475c40cfdc092411 (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2017-01-19' into staging
Error reporting patches for 2017-01-19 # gpg: Signature made Thu 19 Jan 2017 14:51:17 GMT # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-error-2017-01-19: error: Report certain hints on stderr when no monitor error: error_setg_errno(): errno gets preserved Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/qapi/error.h3
-rw-r--r--monitor.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 0576659603..7e532d00e9 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -170,6 +170,9 @@ void error_setg_internal(Error **errp,
* Just like error_setg(), with @os_error info added to the message.
* If @os_error is non-zero, ": " + strerror(os_error) is appended to
* the human-readable error message.
+ *
+ * The value of errno (which usually can get clobbered by almost any
+ * function call) will be preserved.
*/
#define error_setg_errno(errp, os_error, fmt, ...) \
error_setg_errno_internal((errp), __FILE__, __LINE__, __func__, \
diff --git a/monitor.c b/monitor.c
index 0841d436b0..90c5bafcc3 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
{
if (cur_mon && !monitor_cur_is_qmp()) {
monitor_vprintf(cur_mon, fmt, ap);
+ } else if (!cur_mon) {
+ vfprintf(stderr, fmt, ap);
}
}