From 802bd75210b982c7bfb0159db1172827925c8e3f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 6 Dec 2015 23:40:42 -0500 Subject: minor fixes to the XDG_RUNTIME_DIR implementation --- .config/login.d/02_xdg_runtime_dir.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '.config/login.d') diff --git a/.config/login.d/02_xdg_runtime_dir.sh b/.config/login.d/02_xdg_runtime_dir.sh index 6db58af..6e3e4ad 100644 --- a/.config/login.d/02_xdg_runtime_dir.sh +++ b/.config/login.d/02_xdg_runtime_dir.sh @@ -5,11 +5,11 @@ if [ -z "$XDG_RUNTIME_DIR" ] && type flock &>/dev/null; then _diy_xdg_runtime_login() { export XDG_RUNTIME_DIR="$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" if ! [ /dev/fd/7 -ef "$XDG_CACHE_HOME/xdg-runtime-dir/.lock" ]; then + mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" exec 7>"$XDG_CACHE_HOME/xdg-runtime-dir/.lock" if flock -xn 7; then if [ ! -d "$XDG_RUNTIME_DIR" ]; then local tmp="$(mktemp -d --tmpdir -- "${USER}@${HOSTNAME}-runtime.XXXXXXXXXX")" - mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" ln -sfT -- "$tmp" "$XDG_RUNTIME_DIR" fi # Unfortunately this doesn't survive across exec(1). @@ -19,7 +19,6 @@ if [ -z "$XDG_RUNTIME_DIR" ] && type flock &>/dev/null; then fi } _diy_xdg_runtime_logout() { - exec 7>&- exec 7>"$XDG_CACHE_HOME/xdg-runtime-dir/.lock" if flock -xn 7; then rm -rf -- "$(readlink "$XDG_RUNTIME_DIR")" -- cgit v1.2.3-2-g168b