vfs: don't crash if copy_file can't open output file (LP 1687283)
This commit is contained in:
parent
8b3ad7348e
commit
1b690e528f
|
|
@ -150,7 +150,16 @@ copy_file(VirtualFile *new_file) {
|
|||
// Different mount point, or the mount doesn't support copying. Do it by
|
||||
// hand.
|
||||
ostream *out = new_file->open_write_file(false, true);
|
||||
if (out == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
istream *in = open_read_file(false);
|
||||
if (in == nullptr) {
|
||||
new_file->close_write_file(out);
|
||||
new_file->delete_file();
|
||||
return false;
|
||||
}
|
||||
|
||||
static const size_t buffer_size = 4096;
|
||||
char buffer[buffer_size];
|
||||
|
|
|
|||
Loading…
Reference in New Issue