[fpc-pascal] Check root privs

Michael Van Canneyt michael at freepascal.org
Mon Mar 14 11:34:38 CET 2005



On Mon, 14 Mar 2005, [iso-8859-1] Michaÿffffb3 Woÿffff9fniak wrote:

> Hi there.
>
> First of all, I am new here and would like to say
> "Hello" to all you guys on this list.
>
> Now the question:
> I am developing a simple program under Linux, that is
> to use RAW sockets. Therefore it *requires* root
> priviledges.
> Does anyone know how to check for them _before_ I get
> an AV trying to send using a RAW socket? :)
> [Obviously, I handle the exception, but I need to tell
> the user they need root privs]

Normally, you can do getuid or geteuid to get the user ID,
if it is zero, you know it's the root user.

Michael.


More information about the fpc-pascal mailing list