KSaveFile

Julian Rockey linux at jrockey.com
Sun Feb 22 16:05:01 GMT 2004


On Sunday 22 Feb 2004 14:32, Dirk Mueller wrote:
> On Sunday 22 February 2004 13:51, Julian Rockey wrote:
> > OK to commit this?
>
> - use fchmod instead of chmod, otherwise its vulnerable to a rename race..
> - why lstat? when the original file is a symlink then the permissions will
> be world read/writeable.
I don't think there can be a rename race as the temp file being chmodded was 
created by KTempFile, and has not been closed, so is still open O_EXCL. 
Still,  I supposed it's better to use fchmod as good practice.

Point taken about the sym links, and in fact we should go further and avoid 
clobbering them (as it does now, with or without the previous patch). Revised 
patch attached.

While we're at it, perhaps KTempFile should do use fchmod/fchown too?
cheers
Julian

>
>
> Dirk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ksavefile-2.patch
Type: text/x-diff
Size: 1633 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040222/97d6ba80/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ktempfile.patch
Type: text/x-diff
Size: 669 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040222/97d6ba80/attachment-0001.patch>


More information about the kde-core-devel mailing list