Changeset 54367


Ignore:
Timestamp:
Jul 25, 2009, 4:52:18 PM (9 years ago)
Author:
jmr@…
Message:

fix reading of ${target}.asroot settings, and fix permission problems in reinplace (#20330)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r54236 r54367  
    912912        }
    913913
    914         eval file attributes {$file} $attributes
     914        fileAttrsAsRoot $file $attributes
    915915
    916916        file delete "$tmpfile"
     
    12201220    if {$procedure != ""} {
    12211221        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] } {
    12231225            elevateToRoot $targetname
    12241226        }
     
    23592361
    23602362##
     2363# Change attributes of file while running as root
     2364#
     2365# @param file the file in question
     2366# @param attributes the attributes for the file
     2367proc fileAttrsAsRoot {file attributes} {
     2368    global euid macportsuser
     2369    if {[getuid] == 0 && [geteuid] != 0} {
     2370        # Started as root, but not root now
     2371        seteuid $euid
     2372        ui_debug "euid changed to: [geteuid]"
     2373        ui_debug "setting attributes on $file"
     2374        eval file attributes {$file} $attributes
     2375        seteuid [name_to_uid "$macportsuser"]
     2376        ui_debug "euid changed to: [geteuid]"
     2377    } else {
     2378        eval file attributes {$file} $attributes
     2379    }
     2380}
     2381
     2382##
    23612383# Elevate privileges back to root.
    23622384#
Note: See TracChangeset for help on using the changeset viewer.