QSaveFile: Check for EINTR in fsync()/fdatasync()
[ChangeLog][QtCore][QSaveFile] Fixed an issue that would cause QSaveFile::commit() to fail if Unix signals were delivered at the same time. Task-number: QTBUG-66268 Change-Id: I3debfc11127e4516b505fffd151148e70662cd5e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
c48f4bde00
commit
4ba535616b
@ -180,10 +180,11 @@ bool QFSFileEnginePrivate::nativeFlush()
|
||||
bool QFSFileEnginePrivate::nativeSyncToDisk()
|
||||
{
|
||||
Q_Q(QFSFileEngine);
|
||||
int ret;
|
||||
#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
|
||||
const int ret = fdatasync(nativeHandle());
|
||||
EINTR_LOOP(ret, fdatasync(nativeHandle()));
|
||||
#else
|
||||
const int ret = fsync(nativeHandle());
|
||||
EINTR_LOOP(ret, fsync(nativeHandle()));
|
||||
#endif
|
||||
if (ret != 0)
|
||||
q->setError(QFile::WriteError, qt_error_string(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user