summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-10-04 15:04:21 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-10-04 15:04:21 -0400
commit1cdc7055122eae4a260b0f6f5aaa5522af145e43 (patch)
treec72729c9fc35af316c507893bb99762cb44355e6
parent9abaebb597d396a24c51f7c7c03e4145963f6bb1 (diff)
Be more careful about what happens when XDG_RUNTIME_DIR isn't set.
-rw-r--r--.config/X11/clientrc5
-rw-r--r--.config/login.d/90_dot-runtime.sh6
-rw-r--r--.config/wmii-hg/include.sh4
-rw-r--r--.config/wmii-hg/rbar.sh5
4 files changed, 18 insertions, 2 deletions
diff --git a/.config/X11/clientrc b/.config/X11/clientrc
index ac0d5a8..bc68ed6 100644
--- a/.config/X11/clientrc
+++ b/.config/X11/clientrc
@@ -17,7 +17,10 @@ if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
-[ -n "$XDG_RUNTIME_DIR" ] || exit 1
+if [ -z "$XDG_RUNTIME_DIR" ]; then
+ printf "XDG_RUNTIME_DIR isn't set\n" >&2
+ exit 6
+fi
_DISPLAY="$(systemd-escape -- "$DISPLAY")"
trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}")" EXIT
mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}"
diff --git a/.config/login.d/90_dot-runtime.sh b/.config/login.d/90_dot-runtime.sh
index d06568f..cb0b7f2 100644
--- a/.config/login.d/90_dot-runtime.sh
+++ b/.config/login.d/90_dot-runtime.sh
@@ -1,4 +1,8 @@
# This is really only needed for ssh ControlPath; as I don't have a
# way to communicate XDG_RUNTIME_DIR to it otherwise.
mkdir -p -- ~/.runtime
-ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime/"$HOSTNAME"
+if [ -n "$XDG_RUNTIME_DIR" ]; then
+ ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime/"$HOSTNAME"
+else
+ ln -sfT -- /tmp ~/.runtime/"$HOSTNAME"
+fi
diff --git a/.config/wmii-hg/include.sh b/.config/wmii-hg/include.sh
index 4e86276..f8c4e0d 100644
--- a/.config/wmii-hg/include.sh
+++ b/.config/wmii-hg/include.sh
@@ -1,4 +1,8 @@
#!/hint/bash
+if [[ -z "$XDG_RUNTIME_DIR" ]]; then
+ printf "XDG_RUNTIME_DIR isn't set\n" >&2
+ exit 6
+fi
if [[ -z "$WMII_NAMESPACE" ]]; then
export WMII_NAMESPACE="$(wmiir namespace)"
diff --git a/.config/wmii-hg/rbar.sh b/.config/wmii-hg/rbar.sh
index 0c9efa6..287f427 100644
--- a/.config/wmii-hg/rbar.sh
+++ b/.config/wmii-hg/rbar.sh
@@ -1,4 +1,9 @@
#!/hint/bash
+if [[ -z "$XDG_RUNTIME_DIR" ]]; then
+ printf "XDG_RUNTIME_DIR isn't set\n" >&2
+ exit 6
+fi
+
setup_trap() {
trap "rm -f -- \"\${XDG_RUNTIME_DIR}\"/n/wmii*/rbar/${1}" EXIT
}