Don't override SCREENDIR when screen is setuid.
authorIain Patterson <me@iain.cx>
Fri, 27 Feb 2009 12:13:37 +0000 (12:13 +0000)
committerIain Patterson <me@iain.cx>
Fri, 27 Feb 2009 12:13:37 +0000 (12:13 +0000)
git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@179 6be0d1a5-5cfe-0310-89b6-964be062b18b

.profile.d/variables.bashrc

index 8fa34ab..616be4e 100644 (file)
@@ -25,5 +25,13 @@ elif [ $colours -gt 88 ]; then
 else
   export GREP_COLORS='cx=31:sl=:mt=33:fn=36:ln=34:bn=33:se=31'
 fi
-export SCREENDIR="$HOME/.screen/$HOSTNAME"
+
+# Override SCREENDIR iff screen is not setuid.
+screen=$(which screen 2>/dev/null)
+if [ ! -z "$screen" ]; then
+  if ! ls -l "$screen" | cut -d ' ' -f 1 | grep s >/dev/null; then
+    export SCREENDIR="$HOME/.screen/$HOSTNAME"
+  fi
+fi
+unset screen
 #mkdir -p "$SCREENDIR"