From b062ad86dcd33ab39be5060b0655d8e13834b167 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 12 May 2015 09:10:56 -0600 Subject: qemu-io: Use getopt() correctly POSIX says getopt() returns -1 on completion. While Linux happens to define EOF as -1, this definition is not required by POSIX, and there may be platforms where checking for EOF instead of -1 would lead to an infinite loop. Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- qemu-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qemu-io.c') diff --git a/qemu-io.c b/qemu-io.c index 8e41080cc9..ae5e274a7f 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -120,7 +120,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv) QemuOpts *qopts; QDict *opts; - while ((c = getopt(argc, argv, "snrgo:")) != EOF) { + while ((c = getopt(argc, argv, "snrgo:")) != -1) { switch (c) { case 's': flags |= BDRV_O_SNAPSHOT; -- cgit v1.2.1