On 07.04.2014 20:55, Eric Blake wrote:
On 04/07/2014 11:29 AM, Max Reitz wrote:
As speed is an optional parameter for the QMP block-commit command, it
should be set to 0 if not given (as it is undefined if has_speed is
false), that is, the speed should not be limited.
Signed-off-by: Max Reitz <mre...@redhat.com>
---
blockdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/blockdev.c b/blockdev.c
index 0be4601..337c11f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1876,6 +1876,7 @@ void qmp_block_commit(const char *device,
*/
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
+ speed = speed ? speed : 0;
Oops, branching based on the contents of an undefined variable. You
meant has_speed in the second of the three uses.
Right – this way, it makes little sense but as a test for compiler
optimizations. ;-)
Max