Revision 319ae529

b/blockdev.c
203 203
    }
204 204
}
205 205

  
206
DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
206
DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
207 207
{
208 208
    const char *buf;
209 209
    const char *file = NULL;
......
225 225
    int snapshot = 0;
226 226
    int ret;
227 227

  
228
    *fatal_error = 1;
229

  
230 228
    translation = BIOS_ATA_TRANSLATION_AUTO;
231 229

  
232 230
    if (default_to_scsi) {
......
499 497
        abort();
500 498
    }
501 499
    if (!file || !*file) {
502
        *fatal_error = 0;
503
        return NULL;
500
        return dinfo;
504 501
    }
505 502
    if (snapshot) {
506 503
        /* always use cache=unsafe with snapshot */
......
529 526

  
530 527
    if (bdrv_key_required(dinfo->bdrv))
531 528
        autostart = 0;
532
    *fatal_error = 0;
533 529
    return dinfo;
534 530
}
535 531

  
b/blockdev.h
48 48
QemuOpts *drive_def(const char *optstr);
49 49
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
50 50
                    const char *optstr);
51
DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi, int *fatal_error);
51
DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi);
52 52

  
53 53
/* device-hotplug */
54 54

  
b/hw/device-hotplug.c
29 29

  
30 30
DriveInfo *add_init_drive(const char *optstr)
31 31
{
32
    int fatal_error;
33 32
    DriveInfo *dinfo;
34 33
    QemuOpts *opts;
35 34

  
......
37 36
    if (!opts)
38 37
        return NULL;
39 38

  
40
    dinfo = drive_init(opts, current_machine->use_scsi, &fatal_error);
39
    dinfo = drive_init(opts, current_machine->use_scsi);
41 40
    if (!dinfo) {
42 41
        qemu_opts_del(opts);
43 42
        return NULL;
b/hw/usb-msd.c
542 542
    QemuOpts *opts;
543 543
    DriveInfo *dinfo;
544 544
    USBDevice *dev;
545
    int fatal_error;
546 545
    const char *p1;
547 546
    char fmt[32];
548 547

  
......
572 571
    qemu_opt_set(opts, "if", "none");
573 572

  
574 573
    /* create host drive */
575
    dinfo = drive_init(opts, 0, &fatal_error);
574
    dinfo = drive_init(opts, 0);
576 575
    if (!dinfo) {
577 576
        qemu_opts_del(opts);
578 577
        return NULL;
b/vl.c
631 631
static int drive_init_func(QemuOpts *opts, void *opaque)
632 632
{
633 633
    int *use_scsi = opaque;
634
    int fatal_error = 0;
635 634

  
636
    if (drive_init(opts, *use_scsi, &fatal_error) == NULL) {
637
        if (fatal_error)
638
            return 1;
639
    }
640
    return 0;
635
    return drive_init(opts, *use_scsi) == NULL;
641 636
}
642 637

  
643 638
static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
......
666 661
    if (snapshot) {
667 662
        drive_enable_snapshot(opts, NULL);
668 663
    }
669
    if (drive_init_func(opts, &use_scsi)) {
664
    if (!drive_init(opts, use_scsi)) {
670 665
        exit(1);
671 666
    }
672 667
}

Also available in: Unified diff