QLockFile: fix errno handling
In case of a lock failure, we potentially pollute the errno value before printing it. Also, switch to qt_error_string, as strerror is not reentrant. Change-Id: I952aac14204637155726bcefc0ed8a21d7fcd501 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
0cfdfcc82e
commit
a2f6ece27f
@ -171,8 +171,10 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
}
|
||||
}
|
||||
// Ensure nobody else can delete the file while we have it
|
||||
if (!setNativeLocks(fd))
|
||||
qWarning() << "setNativeLocks failed:" << strerror(errno);
|
||||
if (!setNativeLocks(fd)) {
|
||||
const int errnoSaved = errno;
|
||||
qWarning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);
|
||||
}
|
||||
|
||||
if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) {
|
||||
close(fd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user