Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(run): skip the Wine process sweep when /tmp/.wine-<uid> is a link or another user's

raymondchins545a9a71ce8b
diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.sh
index 7799ff2..8571552 100755
--- a/dylib/feats/compat_run.sh
+++ b/dylib/feats/compat_run.sh
@@ -1899,8 +1899,14 @@ prefix_server_dir() {
[ -n "${1:-$WINEPREFIX}" ] || return 1
ids=$(stat -f '%d-%i' "${1:-$WINEPREFIX}" 2>/dev/null) || return 1
[ -n "$ids" ] || return 1
- printf '/tmp/.wine-%s/server-%s' "$(id -u)" \
- "$(printf '%s' "$ids" | awk -F- '{printf "%x-%x", $1, $2}')"
+ # Callers lsof and kill -9 whatever is open under this path: refuse a link or a folder
+ # another macOS user planted in the shared /tmp.
+ for owned in "/tmp/.wine-$(id -u)" \
+ "/tmp/.wine-$(id -u)/server-$(printf '%s' "$ids" | awk -F- '{printf "%x-%x", $1, $2}')"; do
+ [ ! -L "$owned" ] || return 1
+ [ ! -e "$owned" ] || [ "$(stat -f %u "$owned" 2>/dev/null)" = "$(id -u)" ] || return 1
+ done
+ printf '%s' "$owned"
}
sweep_dead_seeds() {