[PATCH 1/7] os: Remove any old logfile before trying to write to it

Ángel González ingenit at zoho.com
Thu Nov 8 10:23:16 PST 2012


On 08/11/12 18:21, walter harms wrote:
> Am 08.11.2012 14:41, schrieb Jon TURNEY:
>> If we are not backing up logfiles, remove the old logfile before trying to write
>> a new logfile, as otherwise the operation may fail if the previous logfile was
>> created by a different user.
>>
> 
> what are the permissions of that file ?
> normally you can  not remove any file that is not worn by your.
> I would print an advive to use rm /logfile if the creation failed.
> 
> just my 2 cents
> 
> re,
>  wh

It's not the permissions of the file what matters, but those of the
folder where it lives.
If you can write in that folder, and it doesn't have the sticky bit set,
you can also delete files.
Extended attributes and security modules could change that, obviously.

I find the commit message quite clear in what it expects and its
limitations.
I tried to make up a use case where the logfile was being used by a user
and removing it actually made it fail because it couldn't be recreated,
but then, the it's unlikely that unlink() would have worked.
It would have to be a setup with multiple users on a sticky folder.



More information about the xorg-devel mailing list