aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-19 14:44:22 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-19 14:44:22 +0000
commit83ab7950d23f037a665d17806fc903ca3565510c (patch)
tree1b22c134d433c09379178089affe6b66c9eedd73 /vl.c
parentf99ed40ad8f089eb18bf19c9473e72bb2d257c92 (diff)
downloadqemu-83ab7950d23f037a665d17806fc903ca3565510c.zip
qemu-83ab7950d23f037a665d17806fc903ca3565510c.tar.gz
qemu-83ab7950d23f037a665d17806fc903ca3565510c.tar.bz2
Revert r4979 since it breaks the monitor
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5028 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/vl.c b/vl.c
index 281d067..ff9aed9 100644
--- a/vl.c
+++ b/vl.c
@@ -5721,7 +5721,7 @@ static int drive_init(struct drive_opt *arg, int snapshot,
bdrv_flags |= BDRV_O_SNAPSHOT;
if (!cache)
bdrv_flags |= BDRV_O_DIRECT;
- if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) {
+ if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) {
fprintf(stderr, "qemu: could not open disk image %s\n",
file);
return -1;
@@ -8009,14 +8009,22 @@ int qemu_key_check(BlockDriverState *bs, const char *name)
return -EPERM;
}
+static BlockDriverState *get_bdrv(int index)
+{
+ if (index > nb_drives)
+ return NULL;
+ return drives_table[index].bdrv;
+}
+
static void read_passwords(void)
{
BlockDriverState *bs;
int i;
- for(i = 0; i < nb_drives; i++) {
- bs = drives_table[i].bdrv;
- qemu_key_check(bs, bdrv_get_device_name(bs));
+ for(i = 0; i < 6; i++) {
+ bs = get_bdrv(i);
+ if (bs)
+ qemu_key_check(bs, bdrv_get_device_name(bs));
}
}
@@ -8185,7 +8193,6 @@ int main(int argc, char **argv)
int optind;
const char *r, *optarg;
CharDriverState *monitor_hd;
- int has_monitor;
const char *monitor_device;
const char *serial_devices[MAX_SERIAL_PORTS];
int serial_device_index;
@@ -9055,8 +9062,6 @@ int main(int argc, char **argv)
}
/* Maintain compatibility with multiple stdio monitors */
-
- has_monitor = 0;
if (!strcmp(monitor_device,"stdio")) {
for (i = 0; i < MAX_SERIAL_PORTS; i++) {
const char *devname = serial_devices[i];
@@ -9069,7 +9074,6 @@ int main(int argc, char **argv)
break;
}
}
- has_monitor = 1;
}
if (monitor_device) {
monitor_hd = qemu_chr_open(monitor_device);
@@ -9078,7 +9082,6 @@ int main(int argc, char **argv)
exit(1);
}
monitor_init(monitor_hd, !nographic);
- has_monitor = 1;
}
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
@@ -9139,16 +9142,12 @@ int main(int argc, char **argv)
}
#endif
- read_passwords();
-
- if (has_monitor)
- monitor_start_input();
-
if (loadvm)
do_loadvm(loadvm);
{
/* XXX: simplify init */
+ read_passwords();
if (autostart) {
vm_start();
}