diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-08-15 13:41:55 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-08-15 13:41:55 +0100 |
commit | f083201667fddd51055c2ac67f67221e82298a35 (patch) | |
tree | cda4c0cc323eb22c8f58cfd9d7c199a02ec2182a /qemu-img.c | |
parent | 2d591ce2aeebf9620ff527c7946844a3122afeec (diff) | |
parent | 169a24aea4f287739797a8b15565b9b5e59e53be (diff) |
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-08-09' into staging
trivial patches for 2014-08-09
# gpg: Signature made Fri 08 Aug 2014 21:36:44 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg: aka "Michael Tokarev <mjt@corpit.ru>"
# gpg: aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5
# Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514 66A7 BEE5 9D74 A4C3 D7DB
* remotes/mjt/tags/trivial-patches-2014-08-09:
build-sys: Move qapi-{types, visit, event}.o into util-obj-y
po: Add Chinese translation
qemu-img: Check getchar() return value in read_password() for WIN32
hw/timer: Move extern declaration from .c to .h file
virtio: Move extern declaration to header file
Show length mismatch error is hex
target-i386/cpu.c: Fix two error output indentation
l2tpv3 (configure): it is linux-specific
hw/timer/imx_*: fix TIMER_MAX clash with system symbol
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/qemu-img.c b/qemu-img.c index d4518e724f..19495bb594 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -185,15 +185,20 @@ static int GCC_FMT_ATTR(2, 3) qprintf(bool quiet, const char *fmt, ...) static int read_password(char *buf, int buf_size) { int c, i; + printf("Password: "); fflush(stdout); i = 0; for(;;) { c = getchar(); - if (c == '\n') + if (c < 0) { + buf[i] = '\0'; + return -1; + } else if (c == '\n') { break; - if (i < (buf_size - 1)) + } else if (i < (buf_size - 1)) { buf[i++] = c; + } } buf[i] = '\0'; return 0; |