Ticket #20330: portutil.tcl.patch
File portutil.tcl.patch, 1.5 KB (added by mtalexander (Mike Alexander), 15 years ago) |
---|
-
base/src/port1.0/portutil.tcl
911 911 return -code error "reinplace copy failed" 912 912 } 913 913 914 eval file attributes {$file}$attributes914 fileAttrsAsRoot $file $attributes 915 915 916 916 file delete "$tmpfile" 917 917 } … … 1219 1219 1220 1220 if {$procedure != ""} { 1221 1221 set targetname [ditem_key $ditem name] 1222 if { [tbool ${targetname}.asroot] } { 1222 set target [ditem_key $ditem provides] 1223 global ${target}.asroot 1224 if { [tbool ${target}.asroot] } { 1223 1225 elevateToRoot $targetname 1224 1226 } 1225 1227 … … 2354 2356 } 2355 2357 2356 2358 ## 2359 # Change attributes of file while running as root 2360 # 2361 # @param file the file in question 2362 # @param attributes the attributes for the file 2363 proc fileAttrsAsRoot {file attributes} { 2364 global euid macportsuser 2365 if {[getuid] == 0 && [geteuid] != 0} { 2366 # Started as root, but not root now 2367 seteuid $euid 2368 ui_debug "euid changed to: [geteuid]" 2369 eval file attributes {$file} $attributes 2370 seteuid [name_to_uid "$macportsuser"] 2371 ui_debug "euid changed to: [geteuid]" 2372 } else { 2373 eval file attributes {$file} $attributes 2374 } 2375 } 2376 2377 ## 2357 2378 # Elevate privileges back to root. 2358 2379 # 2359 2380 # @param action the action for which privileges are being elevated