Commit cfef6a45 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by Kevin Wolf
Browse files

qemu-img: fix failed autotests



There are 9 iotests failed on Ubuntu 15.10 at the moment.
The problem is that options parsing in qemu-img is broken by the
following commit:
    commit 10985131
    Author: Denis V. Lunev <den@openvz.org>
    Date:   Fri Jun 17 17:44:13 2016 +0300
    qemu-img: move common options parsing before commands processing

This strange command line reports error
  ./qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- 1024
  qemu-img: Invalid image size specified!
while original code parses it successfully.

The problem is that getopt_long state should be reset. This could be done
using this assignment according to the manual:
    optind = 0

Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 60a0f1af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3866,7 +3866,7 @@ int main(int argc, char **argv)
        return 0;
    }
    argv += optind;
    optind = 1;
    optind = 0;

    if (!trace_init_backends()) {
        exit(1);