Allow running as non-root to execute RN macros

This commit is contained in:
Brian McGlynn 2020-07-29 17:14:48 -04:00
parent fa95dc14d1
commit e3bc3d99f6

View File

@ -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