Revision f5edb014 qemu-img.c

b/qemu-img.c
204 204
    } else {
205 205
        drv = NULL;
206 206
    }
207
    if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
207
    if (bdrv_open2(bs, filename, BRDV_O_FLAGS | BDRV_O_RDWR, drv) < 0) {
208 208
        error("Could not open '%s'", filename);
209 209
    }
210 210
    if (bdrv_is_encrypted(bs)) {
......
468 468
    } else {
469 469
        drv = NULL;
470 470
    }
471
    if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
471
    if (bdrv_open2(bs, filename, BRDV_O_FLAGS | BDRV_O_RDWR, drv) < 0) {
472 472
        error("Could not open '%s'", filename);
473 473
    }
474 474
    ret = bdrv_commit(bs);
......
966 966
    BlockDriverState *bs;
967 967
    QEMUSnapshotInfo sn;
968 968
    char *filename, *snapshot_name = NULL;
969
    int c, ret;
969
    int c, ret, bdrv_oflags;
970 970
    int action = 0;
971 971
    qemu_timeval tv;
972 972

  
973
    bdrv_oflags = BDRV_O_RDWR;
973 974
    /* Parse commandline parameters */
974 975
    for(;;) {
975 976
        c = getopt(argc, argv, "la:c:d:h");
......
985 986
                return 0;
986 987
            }
987 988
            action = SNAPSHOT_LIST;
989
            bdrv_oflags &= ~BDRV_O_RDWR; /* no need for RW */
988 990
            break;
989 991
        case 'a':
990 992
            if (action) {
......
1022 1024
    if (!bs)
1023 1025
        error("Not enough memory");
1024 1026

  
1025
    if (bdrv_open2(bs, filename, 0, NULL) < 0) {
1027
    if (bdrv_open2(bs, filename, bdrv_oflags, NULL) < 0) {
1026 1028
        error("Could not open '%s'", filename);
1027 1029
    }
1028 1030

  

Also available in: Unified diff