summary refs log tree commit diff stats
path: root/hw/core/guest-loader.c
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2025-05-31 20:16:01 +0300
committerKevin Wolf <kwolf@redhat.com>2025-07-15 20:49:01 +0200
commit8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b (patch)
tree2038a5b3c001934290c90c02f080325d51b78da4 /hw/core/guest-loader.c
parentc1563952521d4d5947b4279efe8dcc432791287e (diff)
downloadfocaccia-qemu-8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b.tar.gz
focaccia-qemu-8737b342e236c8cf5e4ae1f5cc0f519a23a6dd2b.zip
qemu-img: resize: do not always eat last argument
'qemu-img resize --help' does not work, since it wants more
arguments.  Also -size is only recognized as a very last
argument, but it is common for tools to handle other options
after positional arguments too.

Tell getopt_long() to return non-options together with options,
and process filename and size in the loop, and check if there's
an argument right after filename which looks like -N (number),
and treat it as size (decrement).  This way we can handle --help,
and we can also have options after filename and size, and `--'
will be handled fine too.

The only case which is not handled right is when there's an option
between filename and size, and size is given as decrement, - in
this case -size will be treated as option, not as size.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20250531171609.197078-20-mjt@tls.msk.ru>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/core/guest-loader.c')
0 files changed, 0 insertions, 0 deletions