diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-11-15 16:32:12 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-11-15 16:32:12 -0800 |
commit | fbcf6aa641e5827da48a3b6776c9897de123b405 (patch) | |
tree | 6c460f88fdc83d551bcf7b446a05117b721231cc | |
parent | c4c880c5a2ac521d4a6d0bad132d38dfff375a6c (diff) | |
download | unicorn-fbcf6aa641e5827da48a3b6776c9897de123b405.tar.gz |
We're only allowed 108 bytes for Unix domain sockets. mktemp(1) usually generates path names of reasonable length and we rely on it anyways.
-rw-r--r-- | t/test-lib.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index cab2cc3..7979111 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -38,20 +38,29 @@ rtmpfiles () { for id in "$@" do name=$id - _tmp=$t_pfx.$id - eval "$id=$_tmp" case $name in *fifo) + _tmp=$t_pfx.$id + eval "$id=$_tmp" rm -f $_tmp mkfifo $_tmp T_RM_LIST="$T_RM_LIST $_tmp" ;; *socket) + _tmp="$(mktemp -t $id.$$.XXXXXXXX)" + if test $(printf "$_tmp" |wc -c) -gt 108 + then + echo >&2 "$_tmp too long, tests may fail" + echo >&2 "Try to set TMPDIR to a shorter path" + fi + eval "$id=$_tmp" rm -f $_tmp T_RM_LIST="$T_RM_LIST $_tmp" ;; *) + _tmp=$t_pfx.$id + eval "$id=$_tmp" > $_tmp T_OK_RM_LIST="$T_OK_RM_LIST $_tmp" ;; |