Revision 7c96d46e block.c
b/block.c | ||
---|---|---|
338 | 338 |
if (flags & BDRV_O_SNAPSHOT) { |
339 | 339 |
BlockDriverState *bs1; |
340 | 340 |
int64_t total_size; |
341 |
int is_protocol = 0; |
|
341 | 342 |
|
342 | 343 |
/* if snapshot, we create a temporary backing file and open it |
343 | 344 |
instead of opening 'filename' directly */ |
... | ... | |
352 | 353 |
return -1; |
353 | 354 |
} |
354 | 355 |
total_size = bdrv_getlength(bs1) >> SECTOR_BITS; |
356 |
|
|
357 |
if (bs1->drv && bs1->drv->protocol_name) |
|
358 |
is_protocol = 1; |
|
359 |
|
|
355 | 360 |
bdrv_delete(bs1); |
356 | 361 |
|
357 | 362 |
get_tmp_filename(tmp_filename, sizeof(tmp_filename)); |
358 |
realpath(filename, backing_filename); |
|
363 |
|
|
364 |
/* Real path is meaningless for protocols */ |
|
365 |
if (is_protocol) |
|
366 |
snprintf(backing_filename, sizeof(backing_filename), |
|
367 |
"%s", filename); |
|
368 |
else |
|
369 |
realpath(filename, backing_filename); |
|
370 |
|
|
359 | 371 |
if (bdrv_create(&bdrv_qcow2, tmp_filename, |
360 | 372 |
total_size, backing_filename, 0) < 0) { |
361 | 373 |
return -1; |
Also available in: Unified diff