diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl index 5b9dd9d3fb..d29dae8b63 100644 --- a/src/macports1.0/macports.tcl +++ b/src/macports1.0/macports.tcl @@ -2833,6 +2833,10 @@ proc mportexec {mport target} { # install them set result [dlist_eval $dlist _mportactive [list _mportexec activate]] + if {[getuid] == 0 && [geteuid] != 0} { + seteuid 0; setegid 0 + } + registry::exclusive_unlock if {$result ne ""} { @@ -2902,6 +2906,11 @@ proc mportexec {mport target} { macports::pop_log } + # Regain privileges that may have been dropped while running the target. + if {[getuid] == 0 && [geteuid] != 0} { + seteuid 0; setegid 0 + } + return $result }