If I'm not entirely mistaken this patch results in simpler and more readable and straight forward code. The current code checks for directories that can not exist since they were removed a few lines before and then creates them.
Index: rc =================================================================== RCS file: /cvs/src/etc/rc,v retrieving revision 1.392 diff -u -p -r1.392 rc --- rc 28 Jul 2011 19:09:16 -0000 1.392 +++ rc 27 Mar 2012 21:34:00 -0000 @@ -183,30 +183,6 @@ make_keys() ssh-keygen -A } -# create Unix sockets directories for X if needed and make sure they have -# correct permissions -setup_X_sockets() -{ - if [ -d /usr/X11R6/lib ]; then - for d in /tmp/.X11-unix /tmp/.ICE-unix ; do - if [ -d $d ]; then - if [ `ls -ld $d | cut -d' ' -f4` \ - != root ]; then - chown root $d - fi - if [ `ls -ld $d | cut -d' ' -f1` \ - != drwxrwxrwt ]; then - chmod 1777 $d - fi - elif [ -e $d ]; then - echo "Error: $d exists and isn't a directory." - else - mkdir -m 1777 $d - fi - done - fi -} - # End subroutines stty status '^T' @@ -442,14 +418,18 @@ fi echo clearing /tmp -# prune quickly with one rm, then use find to clean up /tmp/[lq]* +# Prune quickly with one rm, then use find to clean up /tmp # (not needed with mfs /tmp, but doesn't hurt there...) (cd /tmp && rm -rf [a-km-pr-zA-Z]*) (cd /tmp && find . ! -name . ! -name lost+found ! -name quota.user \ ! -name quota.group -execdir rm -rf -- {} \; -type d -prune) -setup_X_sockets +# Create Unix socket directories for X if needed. +if [ -d /usr/X11R6/lib ]; then + mkdir -m 1777 /tmp/.{X11,ICE}-unix +fi + [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel if [ X"${securelevel}" != X"" ]; then # Han