]> git.proxmox.com Git - qemu.git/commitdiff
qemu-option: Make qemu_opts_foreach() accumulate return values
authorMarkus Armbruster <armbru@redhat.com>
Fri, 29 Jan 2010 18:48:56 +0000 (19:48 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 3 Feb 2010 18:39:01 +0000 (12:39 -0600)
Return the bitwise inclusive or of all return values instead of the
last call's value.  This lets you find out whether any of the calls
returned a non-zero value.

No functional change, as existing users either don't care for the
value, or pass non-zero abort_on_failure, which breaks the loop on the
first non-zero return value.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-option.c

index 24392fcb4c01ad496da8c8b18e4a9df8ce2bacde..a52a4c4a081eb4fa57ad8fef01669c21cc1cd9a0 100644 (file)
@@ -814,7 +814,7 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque,
     int rc = 0;
 
     QTAILQ_FOREACH(opts, &list->head, next) {
-        rc = func(opts, opaque);
+        rc |= func(opts, opaque);
         if (abort_on_failure  &&  rc != 0)
             break;
     }