]> Git Repo - qemu.git/commitdiff
char: Explain qmp_chardev_add()'s unusual error handling
authorMarkus Armbruster <[email protected]>
Mon, 19 May 2014 16:57:36 +0000 (18:57 +0200)
committerGerd Hoffmann <[email protected]>
Wed, 21 May 2014 09:57:58 +0000 (11:57 +0200)
Character backend open hasn't been fully converted to the Error API.
Some opens fail without setting an error.  qmp_chardev_add() needs to
detect when that happens, and set a generic error.  Explain that in a
comment, and inline error_is_set() for clarity.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
qemu-char.c

index 5a7975f39390c08661f1e54f764f715ff1fe0c58..17b476edf06cfaab0e8ed9a497c846ff7b90b690 100644 (file)
@@ -3798,7 +3798,13 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
         break;
     }
 
-    if (chr == NULL && !error_is_set(errp)) {
+    /*
+     * Character backend open hasn't been fully converted to the Error
+     * API.  Some opens fail without setting an error.  Set a generic
+     * error then.
+     * TODO full conversion to Error API
+     */
+    if (chr == NULL && errp && !*errp) {
         error_setg(errp, "Failed to create chardev");
     }
     if (chr) {
This page took 0.02986 seconds and 4 git commands to generate.