aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-05-12 09:10:56 -0600
committerKevin Wolf <kwolf@redhat.com>2015-05-22 17:08:01 +0200
commitb062ad86dcd33ab39be5060b0655d8e13834b167 (patch)
tree60f38226e95d0855988d954705a150948eb6750b /qemu-io.c
parentd1b4efe5c4088fd2289e39b95bbdf73b3dcb7432 (diff)
downloadqemu-b062ad86dcd33ab39be5060b0655d8e13834b167.zip
qemu-b062ad86dcd33ab39be5060b0655d8e13834b167.tar.gz
qemu-b062ad86dcd33ab39be5060b0655d8e13834b167.tar.bz2
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 <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 8e41080..ae5e274 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;