# Merge xauth cookies into home stash. if [ -n "$XAUTHORITY" ]; then if [ -r "$XAUTHORITY" ]; then # If we are root the old file may have been chowned. [ -n "$SUDO_UID" -a -O "$XAUTHORITY" ] && chown "$SUDO_UID" "$XAUTHORITY" [ -n "$SUDO_GID" -a -G "$XAUTHORITY" ] && chgrp "$SUDO_GID" "$XAUTHORITY" # Merge and unset. exec 3<&0 < "$XAUTHORITY" unset XAUTHORITY xauth merge - 2>/dev/null exec <&3 3<&- else # We can't read the file so just unset. unset XAUTHORITY fi fi