Re: Midnight Commander /tmp race

From: Pavel Kankovsky (peakat_private)
Date: Tue Mar 17 1998 - 09:21:09 PST

  • Next message: Cyril Jaouich: "Re: SNI-26: Ascend Router Security Issues"

    On Sun, 15 Mar 1998, Michal Zalewski wrote:
    
    > Midnight Commander (I have version 4.1.8, RedHat 5.0) is launched using
    > the following shell macro:
    >
    > mc=()
    > {
    >     MC=/tmp/mc$$-"$RANDOM";
    >     /usr/bin/mc -P "$@" >"$MC";
    >     cd "`cat $MC`";
    >     rm "$MC";
    >     unset MC
    > }
    >
    > Solution? Use mktemp: MC=`mktemp mc$$-XXXXXX` instead of $RANDOM :)))
    
    Solution? Don't use any temporary file at all.
    
    mc()
    {
            MC=`/usr/bin/mc -P "$@"`
            [ -n "$MC" ] && cd $MC
            unset MC
    }
    
    The function is from mcfn_install script. The alias in lib/mc.csh is
    similar. But lib/mc.sh is the aformentioned lame one. It's absurd.
    
    --Pavel Kankovsky aka Peak   [ Boycott Microsoft -- http://www.vcnet.com/bms ]
    



    This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 13:45:55 PDT