Cleanup in cons.saver



Hello!

I have added support for /dev/vcc/a* in cons.saver. In order to implement
it safely and correctly I used the minor device number of the console
(which I called console_minor).

It turned out that using this variable eliminates a number of hacks and
makes cons.saver more secure. cons.saver no longer parses the argument -
instead it checks the minor number of the console and makes sure that the
console name is either /dev/ttyN or /dev/vc/N where N is console_minor as
defined by fstat(). That's much stricter that the old test, and much
simpler, too.

Using console_minor fixes the problem with /dev/tty10 and above on pre-1.2
kernels. I doubt that anybody ever encountered it, but it's better to have
clean code.

Finally, using strings to indicate errors has been disabled. It's a bad
style. Those strings were not visible to the user anyway.

The patch is not very readable, but everyone if welcome to check new
cons.saver.c - it looks better now.

-- 
Regards,
Pavel Roskin





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