X session finishes, slim goes to restart X, but if the machine is being
halted, slim gets a SIGTERM, and the signal handler tries to kill the X
server without checking if is has been restarted yet. Boom.
While here, fix xauth path.
#529306 & FreeBSD PR134801 :
The security issue is caused by slim generating the X authority file
by passing the X authority cookie via the command line to "xauth".
This can be exploited to disclose the X authority cookie by consulting
the process list and e.g. gain access the user's display.
While here, use slightly better random seeding for cookie generation.
Patches adapted from the ones provided to debian/FreeBSD by Eygene Ryabinkin <rea@codelabs.ru>