1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Using geteuid() to check whether VDR is running as user 'root'

This commit is contained in:
Klaus Schmidinger 2006-04-14 11:04:20 +02:00
parent f3feda52cd
commit f13959a9f2
3 changed files with 7 additions and 2 deletions

View File

@ -1823,3 +1823,6 @@ Jurij Retzlaff <jurij@topofweb.de>
Richard Lithvall <richard@lithvall.se> Richard Lithvall <richard@lithvall.se>
for adding a tolerance for symbol rate values that are off by one for adding a tolerance for symbol rate values that are off by one
Tobias Grimm <listaccount@e-tobi.net>
for suggesting to use geteuid() to check whether VDR is running as user 'root'

View File

@ -4515,3 +4515,5 @@ Video Disk Recorder Revision History
Richard Lithvall). Richard Lithvall).
- Added VBITeletextDescriptorTag, TeletextDescriptorTag, LocalTimeOffsetDescriptorTag - Added VBITeletextDescriptorTag, TeletextDescriptorTag, LocalTimeOffsetDescriptorTag
and PremiereContentTransmissionDescriptor to 'libsi' (thanks to Marco Schlüßler). and PremiereContentTransmissionDescriptor to 'libsi' (thanks to Marco Schlüßler).
- Using geteuid() to check whether VDR is running as user 'root' (suggested by
Tobias Grimm).

4
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/vdr * The project's page is at http://www.cadsoft.de/vdr
* *
* $Id: vdr.c 1.254 2006/04/09 12:22:46 kls Exp $ * $Id: vdr.c 1.255 2006/04/14 11:01:18 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -346,7 +346,7 @@ int main(int argc, char *argv[])
// Set user id in case we were started as root: // Set user id in case we were started as root:
if (VdrUser && getuid() == 0) { if (VdrUser && geteuid() == 0) {
StartedAsRoot = true; StartedAsRoot = true;
if (strcmp(VdrUser, "root")) { if (strcmp(VdrUser, "root")) {
if (!SetKeepCaps(true)) if (!SetKeepCaps(true))