sproc::execute changed sete[u|g]id() to set[u|g]id()

master
Master 2020-08-01 15:44:20 -04:00
parent a5317bfeda
commit c16d69429a
1 changed files with 2 additions and 3 deletions

View File

@ -78,8 +78,7 @@ int Sproc::execute( std::string shell, std::string environment_file, std::string
if ( pid == 0 ) if ( pid == 0 )
{ {
// child process // child process
int setegidval = setegid( run_as_gid ); if ( setgid( run_as_gid ) == 0 )
if ( setegidval == 0 )
{ {
slog.log( E_INFO, "Successfully set GID to '" + std::to_string(run_as_gid) + "' (" + group + ")." ); slog.log( E_INFO, "Successfully set GID to '" + std::to_string(run_as_gid) + "' (" + group + ")." );
} else { } else {
@ -87,7 +86,7 @@ int Sproc::execute( std::string shell, std::string environment_file, std::string
return -401; return -401;
} }
if ( seteuid( run_as_uid ) == 0 ) if ( setuid( run_as_uid ) == 0 )
{ {
slog.log( E_INFO, "Successfully set UID to '" + std::to_string(run_as_uid) + "' (" + run_as + ")." ); slog.log( E_INFO, "Successfully set UID to '" + std::to_string(run_as_uid) + "' (" + run_as + ")." );
} else { } else {