[xorg-x11-server/f13/master] Use mktemp and use it properly.
Matej Cepl
mcepl at fedoraproject.org
Mon Sep 13 16:25:17 UTC 2010
commit 39487d0999dd2043a37548544dae9c9e28c3d853
Author: Matěj Cepl <mcepl at redhat.com>
Date: Mon Sep 13 11:28:30 2010 +0200
Use mktemp and use it properly.
* fixes bug 632879 and bug 499234 (which is CVE-2009-1573)
Signed-off-by: Matěj Cepl <mcepl at redhat.com>
xvfb-run.sh | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/xvfb-run.sh b/xvfb-run.sh
index 836bd6d..0c0855f 100644
--- a/xvfb-run.sh
+++ b/xvfb-run.sh
@@ -147,34 +147,20 @@ trap clean_up EXIT
# If the user did not specify an X authorization file to use, set up a temporary
# directory to house one.
if [ -z "$AUTHFILE" ]; then
- XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
- # Create empty file to avoid xauth warning
- AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
+ XVFB_RUN_TMPDIR="$(mktemp --directory --tmpdir $PROGNAME.XXXXXX)"
+ AUTHFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" Xauthority.XXXXXX)
fi
# Start Xvfb.
MCOOKIE=$(mcookie)
-tries=10
-while [ $tries -gt 0 ]; do
- tries=$(( $tries - 1 ))
- XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
+
+XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
add :$SERVERNUM $XAUTHPROTO $MCOOKIE
EOF
- XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" 2>&1 &
- XVFBPID=$!
-
- sleep "$STARTWAIT"
- if kill -0 $XVFBPID 2>/dev/null; then
- break
- elif [ -n "$AUTONUM" ]; then
- # The display is in use so try another one (if '-a' was specified).
- SERVERNUM=$((SERVERNUM + 1))
- SERVERNUM=$(find_free_servernum)
- continue
- fi
- error "Xvfb failed to start" >&2
- exit 1
-done
+XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
+ 2>&1 &
+XVFBPID=$!
+sleep "$STARTWAIT"
# Start the command and save its exit status.
set +e
More information about the scm-commits
mailing list