From 93a2ecaaa91179e88a113f840dcf6d1a72bf2d92 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 30 Nov 2012 14:00:35 -0500 Subject: [PATCH] enter_chroot: clean out stale ssh dirs Over time, stale ssh agent dirs build up in /tmp. Have enter_chroot run a simple rmdir to clean out any empty dirs. Since we mount over top the dir, this shouldn't kill any valid mount points. BUG=None TEST=`cros_sdk` cleaned out empty ssh dirs in /tmp Change-Id: Ib9f063f99db61825082818a39a39c5eb01f2d24e Reviewed-on: https://gerrit.chromium.org/gerrit/39004 Reviewed-by: David James Reviewed-by: Matt Tennant Reviewed-by: Brian Harring Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- sdk_lib/enter_chroot.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index f200335565..23078ff401 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -282,6 +282,9 @@ setup_env() { fi if [ $FLAGS_ssh_agent -eq $FLAGS_TRUE ]; then + # Clean up previous ssh agents. + rmdir "${FLAGS_chroot}"/tmp/ssh-* 2>/dev/null + if [ -n "${SSH_AUTH_SOCK}" -a -d "${SUDO_HOME}/.ssh" ]; then TARGET_DIR="${FLAGS_chroot}/home/${SUDO_USER}/.ssh" user_mkdir "${TARGET_DIR}"