How to get the minor and major device numbers with os.stat ?

Erik Max Francis max at alcyone.com
Mon Oct 21 05:20:04 CEST 2002


Alain Tesio wrote:

> map(lambda h: eval("0x%s" % h) ...

As an aside, a much better way of converting a string representing a
hexadecimal number to an int is simply with the int function/type:

	int(h, 16)

The version you use above is potentially exploitable by a third party,
particularly since you don't specify an absolute path to stat, so
potentially some third-party version could be executed which might do
something you wouldn't expect.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ A good indignation brings out all one's powers.
\__/ Ralph Waldo Emerson
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.



More information about the Python-list mailing list