bug-gnulib
[Top][All Lists]
Advanced

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

Re: code/module request: undo setuid


From: Ben Pfaff
Subject: Re: code/module request: undo setuid
Date: Wed, 12 Nov 2008 09:52:22 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Bruno Haible <address@hidden> writes:

> /* This is for executables that have the setgid bit set.  */
> #if HAVE_SETREGID
>   setregid (getgid (), getgid ());
> #else
>   setegid (getgid ());
> #endif
> /* This is for executables that have the setuid bit set.  */
> #if HAVE_SETREUID
>   setreuid (getuid (), getuid ());
> #else
>   seteuid (getuid ());
> #endif

Is it worth checking the return values for errors?  It could be
disastrous if an attempt to drop privilege failed.  
-- 
Ben Pfaff 
http://benpfaff.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]