cvs commit: src/etc/rc.d cleartmp

Dmitry Morozovsky marck at rinet.ru
Mon Dec 1 08:56:30 PST 2003


On Mon, 1 Dec 2003, Nate Lawson wrote:

NL> >   When clearing /tmp, X11 lock and temporary files are special.
NL> >   Remove them unconditionaly.
NL> >
NL> >   PR:             bin/59065
NL> >   Approved by:    re (scottl)
NL> >
NL> >   Revision  Changes    Path
NL> >   1.5       +13 -13    src/etc/rc.d/cleartmp
NL> >
NL> >  load_rc_config $name
NL> >  run_rc_command "$1"
NL> > +
NL> > +case ${OSTYPE} in
NL> > +FreeBSD)
NL> > +	# Remove X lock files, since they will prevent you from
NL> > +	# restarting X
NL> > +	#
NL> > +	rm -f /tmp/.X*-lock
NL> > +	rm -fr /tmp/.X11-unix
NL> > +	mkdir -m 1777 /tmp/.X11-unix
NL> > +	;;
NL> > +NetBSD)
NL> > +	;;
NL> > +esac
NL>
NL> How about .X[0-9]-lock instead of *?

Hmm... what about (rare, but possible) situation with symlink poisoning?

Maybe

find /tmp -name '.X[0-9]-lock -type f | xargs rm -f
[ -d /tmp/.X11-unix ] && rm -rf /tmp/.X11-unix
mkdir -m 1777 /tmp/.X11-unix

?

Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------


More information about the cvs-src mailing list