Re: g_file_write()



mortenw gnome org (Morten Welinder) writes:

> fchmod if available?

The patch does use fchmod(). Are there systems we care about where
fchmod() is not available?

> I don't think we care about the permissions being the same as the target
> file's while the file is being created.  In fact, 0000 might be
> preferred.

Well I did it this way to avoid thinking about race conditions where
we would change the permissions of a file that we strictly speaking
couldn't know if we created:

        - create temp file
        - rename temp file to target name
        - someone somehow replaces target with another file
        - we change permissions of some random file

I'm not sure it's a real issue though. On the other hand, I don't
really see what making the permissions 0000 on the temp file buys
us. If someone could accidentally or maliciously tampers with the temp
file, they could just as well tamper with the final file.


Søren



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]