Skip to content

Check for write error in ICalFormat::save() if the disk is full

David Jarvie requested to merge djarvie/kcalendarcore:disk_full_error into master

When the disk is full, at least on Linux when QTemporaryFile creates an unnamed temporary file, ICalFormat::save() returns success despite the write having failed. This wipes out the previous contents of the file being saved.

The bug is due to QSaveFile::write() (Qt versions up to at least 5.14.2) not returning an error if the write fails because the disk is full. A subsequent call to QSaveFile::commit() also returns success in this circumstance. This fix works around this by checking that the file size is the same as the number of bytes requested to be written, and if not, returning an error.

Merge request reports