[Patch] let KSaveFile honor the umask

David Faure faure at kde.org
Wed Mar 26 16:37:43 GMT 2008

On Wednesday 26 March 2008, Thiago Macieira wrote:
> Thorsten Zachmann wrote:
> >Hello all,
> >
> >KSaveFile does not honor the umask for newly created files. Looks like
> > this behaviour was introduces during the port to QTemporaryFile which
> > by default creates file with permissions 0600. This is good for
> > temporary files but for a file saved by an application it is not.
> >The attached patch changes the behaviour so that the KSaveFile does
> > honor the umask for files that are newly created.
> >
> >Ok to commit?
> By calling umask, you make the code thread-unsafe.

Well, this code comes from ktempdir.cpp which uses umask too.
And we never really checked which kdelibs classes are threadsafe, but it's not too late to start I guess.

In both classes, all we want is to "get" the umask, not to set it. How about we get the umask in some
code called during initialization, like the KGlobalPrivate ctor, and we add a KGlobal::umask() accessor?

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list