proposal: add setresuid() system call to python

travis+ml-python at subspacefield.org travis+ml-python at subspacefield.org
Fri Aug 21 22:50:40 CEST 2009


On Mon, Jul 20, 2009 at 04:10:35PM +0200, Hrvoje Niksic wrote:
> To emulate the os-module-type calls, it's better to raise exceptions
> than return negative values:
> 
> > def setresuid(ruid, euid, suid):
> >     return _setresuid(__uid_t(ruid), __uid_t(euid), __uid_t(suid))
> 
> def setresuid(ruid, euid, suid):
>     res = _setresuid(__uid_t(ruid), __uid_t(euid), __uid_t(suid))
>     if res < 0:
>         raise OSError('[Errno %d] %s' % (os.errno, errno.strerror(os.errno)))

I am working on a module to implement all of this, but that raise command
won't work in Python 2.6.1; it turns out that os.errno is a module, not
an integer.  Does anyone know how to do what I want (that is, how to access
the errno set in C functions)?
-- 
Obama Nation | My emails do not have attachments; it's a digital signature
that your mail program doesn't understand. | http://www.subspacefield.org/~travis/ 
If you are a spammer, please email john at subspacefield.org to get blacklisted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 850 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20090821/ef424c1a/attachment.pgp>


More information about the Python-list mailing list