[vdisk/qcow2] Handle the return value of open(2) properly
This commit is contained in:
parent
99515bca17
commit
e027ef8ea9
@ -213,7 +213,7 @@ vdisk_init_qcow2(const char *fname, const struct umka_io *io) {
|
|||||||
};
|
};
|
||||||
d->vdisk.io = io;
|
d->vdisk.io = io;
|
||||||
d->prev_cluster_index = ~(uint64_t)0;
|
d->prev_cluster_index = ~(uint64_t)0;
|
||||||
if (!(d->fd = open(fname, O_RDONLY | O_BINARY))) {
|
if ((d->fd = open(fname, O_RDONLY | O_BINARY)) == -1) {
|
||||||
fprintf(stderr, "[vdisk.qcow2] can't open file '%s': %s\n", fname,
|
fprintf(stderr, "[vdisk.qcow2] can't open file '%s': %s\n", fname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
vdisk_qcow2_close(d);
|
vdisk_qcow2_close(d);
|
||||||
|
Loading…
Reference in New Issue
Block a user