Revision 83ab7950 vl.c

b/vl.c
5721 5721
        bdrv_flags |= BDRV_O_SNAPSHOT;
5722 5722
    if (!cache)
5723 5723
        bdrv_flags |= BDRV_O_DIRECT;
5724
    if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) {
5724
    if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) {
5725 5725
        fprintf(stderr, "qemu: could not open disk image %s\n",
5726 5726
                        file);
5727 5727
        return -1;
......
8009 8009
    return -EPERM;
8010 8010
}
8011 8011

  
8012
static BlockDriverState *get_bdrv(int index)
8013
{
8014
    if (index > nb_drives)
8015
        return NULL;
8016
    return drives_table[index].bdrv;
8017
}
8018

  
8012 8019
static void read_passwords(void)
8013 8020
{
8014 8021
    BlockDriverState *bs;
8015 8022
    int i;
8016 8023

  
8017
    for(i = 0; i < nb_drives; i++) {
8018
        bs = drives_table[i].bdrv;
8019
        qemu_key_check(bs, bdrv_get_device_name(bs));
8024
    for(i = 0; i < 6; i++) {
8025
        bs = get_bdrv(i);
8026
        if (bs)
8027
            qemu_key_check(bs, bdrv_get_device_name(bs));
8020 8028
    }
8021 8029
}
8022 8030

  
......
8185 8193
    int optind;
8186 8194
    const char *r, *optarg;
8187 8195
    CharDriverState *monitor_hd;
8188
    int has_monitor;
8189 8196
    const char *monitor_device;
8190 8197
    const char *serial_devices[MAX_SERIAL_PORTS];
8191 8198
    int serial_device_index;
......
9055 9062
    }
9056 9063

  
9057 9064
    /* Maintain compatibility with multiple stdio monitors */
9058

  
9059
    has_monitor = 0;
9060 9065
    if (!strcmp(monitor_device,"stdio")) {
9061 9066
        for (i = 0; i < MAX_SERIAL_PORTS; i++) {
9062 9067
            const char *devname = serial_devices[i];
......
9069 9074
                break;
9070 9075
            }
9071 9076
        }
9072
        has_monitor = 1;
9073 9077
    }
9074 9078
    if (monitor_device) {
9075 9079
        monitor_hd = qemu_chr_open(monitor_device);
......
9078 9082
            exit(1);
9079 9083
        }
9080 9084
        monitor_init(monitor_hd, !nographic);
9081
        has_monitor = 1;
9082 9085
    }
9083 9086

  
9084 9087
    for(i = 0; i < MAX_SERIAL_PORTS; i++) {
......
9139 9142
    }
9140 9143
#endif
9141 9144

  
9142
    read_passwords();
9143

  
9144
    if (has_monitor)
9145
        monitor_start_input();
9146

  
9147 9145
    if (loadvm)
9148 9146
        do_loadvm(loadvm);
9149 9147

  
9150 9148
    {
9151 9149
        /* XXX: simplify init */
9150
        read_passwords();
9152 9151
        if (autostart) {
9153 9152
            vm_start();
9154 9153
        }

Also available in: Unified diff