mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 22:43:11 +02:00
Allow running as non-root to execute RN macros
This commit is contained in:
parent
fa95dc14d1
commit
e3bc3d99f6
@ -1097,10 +1097,20 @@ void MainObject::RunCommand(const QString &user,const QString &group,
|
||||
//
|
||||
// Run it
|
||||
//
|
||||
if(vfork()==0) {
|
||||
execv(RD_RUNUSER,(char * const *)args);
|
||||
exit(0); // Just in case...
|
||||
}
|
||||
|
||||
//Can only change user/group if we are running as root
|
||||
if(getuid()==0) {
|
||||
if(vfork()==0) {
|
||||
execv(RD_RUNUSER,(char * const *)args);
|
||||
exit(0); // Just in case...
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(fork()==0) {
|
||||
system((const char *)cmd);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Free the heap storage
|
||||
|
Loading…
x
Reference in New Issue
Block a user