]> git.proxmox.com Git - mirror_qemu.git/blobdiff - qemu-img.c
qemu-img/qemu-io: don't prompt for passwords if not required
[mirror_qemu.git] / qemu-img.c
index 9e3ac9c1a871894fd8b5a3e01ed1df6e805a18ec..c57898ee51e0c7e370ff2eb7915142d91268bd01 100644 (file)
@@ -231,7 +231,8 @@ static int img_open_password(BlockBackend *blk, const char *filename,
     char password[256];
 
     bs = blk_bs(blk);
-    if (bdrv_is_encrypted(bs) && !(flags & BDRV_O_NO_IO)) {
+    if (bdrv_is_encrypted(bs) && bdrv_key_required(bs) &&
+        !(flags & BDRV_O_NO_IO)) {
         qprintf(quiet, "Disk image '%s' is encrypted.\n", filename);
         if (qemu_read_password(password, sizeof(password)) < 0) {
             error_report("No password given");