Revision 4f70f249

b/block.c
2773 2773
    drv = bdrv_find_format(fmt);
2774 2774
    if (!drv) {
2775 2775
        error_report("Unknown file format '%s'", fmt);
2776
        ret = -1;
2776
        ret = -EINVAL;
2777 2777
        goto out;
2778 2778
    }
2779 2779

  
2780 2780
    proto_drv = bdrv_find_protocol(filename);
2781 2781
    if (!proto_drv) {
2782 2782
        error_report("Unknown protocol '%s'", filename);
2783
        ret = -1;
2783
        ret = -EINVAL;
2784 2784
        goto out;
2785 2785
    }
2786 2786

  
......
2799 2799
        param = parse_option_parameters(options, create_options, param);
2800 2800
        if (param == NULL) {
2801 2801
            error_report("Invalid options for file format '%s'.", fmt);
2802
            ret = -1;
2802
            ret = -EINVAL;
2803 2803
            goto out;
2804 2804
        }
2805 2805
    }
......
2809 2809
                                 base_filename)) {
2810 2810
            error_report("Backing file not supported for file format '%s'",
2811 2811
                         fmt);
2812
            ret = -1;
2812
            ret = -EINVAL;
2813 2813
            goto out;
2814 2814
        }
2815 2815
    }
......
2818 2818
        if (set_option_parameter(param, BLOCK_OPT_BACKING_FMT, base_fmt)) {
2819 2819
            error_report("Backing file format not supported for file "
2820 2820
                         "format '%s'", fmt);
2821
            ret = -1;
2821
            ret = -EINVAL;
2822 2822
            goto out;
2823 2823
        }
2824 2824
    }
......
2828 2828
        if (!strcmp(filename, backing_file->value.s)) {
2829 2829
            error_report("Error: Trying to create an image with the "
2830 2830
                         "same filename as the backing file");
2831
            ret = -1;
2831
            ret = -EINVAL;
2832 2832
            goto out;
2833 2833
        }
2834 2834
    }
......
2838 2838
        if (!bdrv_find_format(backing_fmt->value.s)) {
2839 2839
            error_report("Unknown backing file format '%s'",
2840 2840
                         backing_fmt->value.s);
2841
            ret = -1;
2841
            ret = -EINVAL;
2842 2842
            goto out;
2843 2843
        }
2844 2844
    }
......
2860 2860
            ret = bdrv_open(bs, backing_file->value.s, flags, drv);
2861 2861
            if (ret < 0) {
2862 2862
                error_report("Could not open '%s'", filename);
2863
                ret = -1;
2864 2863
                goto out;
2865 2864
            }
2866 2865
            bdrv_get_geometry(bs, &size);
......
2870 2869
            set_option_parameter(param, BLOCK_OPT_SIZE, buf);
2871 2870
        } else {
2872 2871
            error_report("Image creation needs a size parameter");
2873
            ret = -1;
2872
            ret = -EINVAL;
2874 2873
            goto out;
2875 2874
        }
2876 2875
    }
......
2901 2900
    if (bs) {
2902 2901
        bdrv_delete(bs);
2903 2902
    }
2904
    if (ret) {
2905
        return 1;
2906
    }
2907
    return 0;
2903

  
2904
    return ret;
2908 2905
}

Also available in: Unified diff