]> xenbits.xensource.com Git - osstest/qemu.git/commitdiff
nbd: Use return values instead of error_is_set(errp)
authorMarkus Armbruster <armbru@redhat.com>
Fri, 25 Apr 2014 14:50:33 +0000 (16:50 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 25 Apr 2014 16:05:06 +0000 (18:05 +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 <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/nbd.c

index 55124239df5286b8398b0555f70fe26158e287bb..613f2581aec6c3acf4bf53c8e25d16e4144a6225 100644 (file)
@@ -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;
         }