[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/5] nbd: Use return values instead of error_is_s
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v2 3/5] nbd: Use return values instead of error_is_set(errp) |
Date: |
Fri, 25 Apr 2014 16:50:33 +0200 |
Using error_is_set(errp) to check whether a function call failed is
fragile: it breaks when errp is null. Check perfectly suitable return
values instead when possible. errp can't be null there now, but this
is more robust and more obviously correct
Signed-off-by: Markus Armbruster <address@hidden>
---
block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/nbd.c b/block/nbd.c
index 5512423..613f258 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -175,7 +175,7 @@ static void nbd_parse_filename(const char *filename, QDict
*options,
InetSocketAddress *addr = NULL;
addr = inet_parse(host_spec, errp);
- if (error_is_set(errp)) {
+ if (!addr) {
goto out;
}
--
1.8.1.4
- [Qemu-devel] [PATCH v2 0/5] block: Purge error_is_set(), Markus Armbruster, 2014/04/25
- [Qemu-devel] [PATCH v2 2/5] qemu-img: Consistently name Error * objects err, and not errp, Markus Armbruster, 2014/04/25
- [Qemu-devel] [PATCH v2 3/5] nbd: Use return values instead of error_is_set(errp),
Markus Armbruster <=
- [Qemu-devel] [PATCH v2 1/5] Use error_is_set() only when necessary (again), Markus Armbruster, 2014/04/25
- [Qemu-devel] [PATCH v2 5/5] iscsi: Don't use error_is_set() to suppress additional errors, Markus Armbruster, 2014/04/25
- [Qemu-devel] [PATCH v2 4/5] blockdev: Clean up fragile use of error_is_set(), Markus Armbruster, 2014/04/25
- Re: [Qemu-devel] [PATCH v2 0/5] block: Purge error_is_set(), Stefan Hajnoczi, 2014/04/25