os: Remove any old logfile before trying to write to it
authorJon TURNEY <jon.turney@dronecode.org.uk>
Thu, 8 Nov 2012 13:41:13 +0000 (13:41 +0000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 10 Jul 2013 21:39:03 +0000 (07:39 +1000)
commit59a6d3f1eb03010ab831b32b03706a1d6143c732
tree1cb63ec25a26448c71c7e7b4d3cd18594ef2cf0b
parent8eeaa74bc241acb41f1d3ed64971e0b01e794776
os: Remove any old logfile before trying to write to it

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.

This change is useful when:
- The DDX doesn't use the logfile backup mechanism (i.e. not Xorg)
- The DDX is run by a non-root user, and then by a different non-root user
- The logfile directory doesn't have the restricted-deletion flag set

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Acked-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
os/log.c