[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/10] nbd: Use return values instead of error_is_set
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 08/10] nbd: Use return values instead of error_is_set(errp) |
Date: |
Fri, 25 Apr 2014 18:07:24 +0200 |
From: Markus Armbruster <address@hidden>
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>
Signed-off-by: Stefan Hajnoczi <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.9.0
- [Qemu-devel] [PULL 00/10] Block patches, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 01/10] block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file., Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 02/10] doc: add -drive rerror=, werror= to qemu --help output, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 03/10] qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed(), Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 04/10] MAINTAINERS: Add qemu-img/io to block subsystem, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 05/10] block: Expose host_* drivers in blockdev-add, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 06/10] Use error_is_set() only when necessary (again), Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 07/10] qemu-img: Consistently name Error * objects err, and not errp, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 08/10] nbd: Use return values instead of error_is_set(errp),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 10/10] iscsi: Don't use error_is_set() to suppress additional errors, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 09/10] blockdev: Clean up fragile use of error_is_set(), Stefan Hajnoczi, 2014/04/25
- Re: [Qemu-devel] [PULL 00/10] Block patches, Peter Maydell, 2014/04/28