forked from qt-creator/qt-creator
Fix saving of hardlinked files
Our atomic write involves writing a temp file and renaming that (which is the only way to achieve something atomic). This creates a new inode, and disconnects any hardlinks. Note that the existing implementation for file paths with needsDevice already keeps hardlinks intact, because even though it first writes into a local temporary file it then writes the content directly into the target with dd. Check the number of hard links via system API and fallback to unsafe writing if there are any, for desktop paths. Fixes: QTCREATORBUG-19651 Change-Id: I3ce1ee81f339f241f0a2c9aa6f2259cb118ebef6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -564,6 +564,11 @@ bool FilePath::isSymLink() const
|
||||
return fileAccess()->isSymLink(*this);
|
||||
}
|
||||
|
||||
bool FilePath::hasHardLinks() const
|
||||
{
|
||||
return fileAccess()->hasHardLinks(*this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a directory in this location.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user