When my application starts, how can I check if the user who started it is running it as su?
Thanks
How to check if my app is being launched by Sudo?
Code: Select all
If getuid_() = 0
; mighty root
Else
; somebody else
EndIfquidquid Latine dictum sit altum videtur
That's good code freak! Compliment, with this I can do programs that are limited for normal users but fully functional for superusers
By the way, when I did a search for getuid_ on Google, I found this page on IBM which is the command reference for Fortran for Linux:
http://publib.boulder.ibm.com/infocente ... getuid.htm
That's a good reference for API calls for Linux
By the way, when I did a search for getuid_ on Google, I found this page on IBM which is the command reference for Fortran for Linux:
http://publib.boulder.ibm.com/infocente ... getuid.htm
That's a good reference for API calls for Linux
I suggest to use the glibc documentation, as that is what PB links to.
It is a very complete and well written manual:
http://www.gnu.org/software/libc/manual ... index.html
(downloadable versions here)
It even is a funny read at times...
the convention of the _ at the end for external commands.
It is a very complete and well written manual:
http://www.gnu.org/software/libc/manual ... index.html
(downloadable versions here)
It even is a funny read at times...
Oh btw, do not seach for "getuid_". The real function name is "getuid". PB just hasAt this point in time this mystery should not be revealed, unless you have the relevant spell-casting materials: ashes from an original DOS 6.2 boot disk burnt in effigy, a crucifix blessed by St. Emacs, assorted herbal roots from Central America, sand from Cebu, etc. Sorry! The part of the implementation where this is used is not yet finished. For now please simply follow the existing examples. It'll become clearer once it is. –drepper
the convention of the _ at the end for external commands.
Last edited by freak on Tue Oct 03, 2006 1:09 pm, edited 1 time in total.
quidquid Latine dictum sit altum videtur
-
DarkDragon
- Addict

- Posts: 2347
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
I like this Linux-API reference more than any other: http://www.mkssoftware.com/docs/api_index.asp
bye,
Daniel
Daniel
> I like this Linux-API reference more than any other: http://www.mkssoftware.com/docs/api_index.asp
There is no such thing as a "linux api" in general. There are several standards, but the
actual implementations may vary. Thats why i suggest to use the documentation
of the library that is actually used, which is the glibc.
There is no such thing as a "linux api" in general. There are several standards, but the
actual implementations may vary. Thats why i suggest to use the documentation
of the library that is actually used, which is the glibc.
quidquid Latine dictum sit altum videtur



