[x2goserver] Use mktemp instead of tempfile

Orion Poplawski orion at fedoraproject.org
Wed Nov 27 17:26:16 UTC 2013


commit 5b885d27722c5c4a5ef11f95159130a51ee04080
Author: Orion Poplawski <orion at nwra.com>
Date:   Wed Nov 27 10:26:07 2013 -0700

    Use mktemp instead of tempfile

 x2goserver-mktemp.patch |   24 ++++++++++++++++++++++++
 x2goserver.spec         |    8 +++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/x2goserver-mktemp.patch b/x2goserver-mktemp.patch
new file mode 100644
index 0000000..dad5061
--- /dev/null
+++ b/x2goserver-mktemp.patch
@@ -0,0 +1,24 @@
+diff -up x2goserver-4.0.1.8/x2goserver-xsession/etc/Xsession.mktemp x2goserver-4.0.1.8/x2goserver-xsession/etc/Xsession
+--- x2goserver-4.0.1.8/x2goserver-xsession/etc/Xsession.mktemp	2013-11-25 14:02:26.170734637 -0700
++++ x2goserver-4.0.1.8/x2goserver-xsession/etc/Xsession	2013-11-25 14:07:54.704734793 -0700
+@@ -74,7 +74,7 @@ ERRFILE=$HOME/.xsession-x2go-errors
+ if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
+   [ ! -L "$ERRFILE" ]; then
+   chmod 600 "$ERRFILE"
+-elif ERRFILE=$(tempfile 2> /dev/null); then
++elif ERRFILE=$(mktemp 2> /dev/null); then
+   if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-x2go-$USER"; then
+     message "warning: unable to symlink \"$TMPDIR/xsession-x2go-$USER\" to" \
+              "\"$ERRFILE\"; look for session log/errors in" \
+@@ -96,9 +96,9 @@ fi
+ # Attempt to create a file of non-zero length in /tmp; a full filesystem can
+ # cause mysterious X session failures.  We do not use touch, :, or test -w
+ # because they won't actually create a file with contents.  We also let standard
+-# error from tempfile and echo go to the error file to aid the user in
++# error from mktemp and echo go to the error file to aid the user in
+ # determining what went wrong.
+-WRITE_TEST=$(tempfile)
++WRITE_TEST=$(mktemp)
+ if ! echo "*" >>"$WRITE_TEST"; then
+   message "warning: unable to write to ${WRITE_TEST%/*}; X session (X2Go) may" \
+           "exit with an error"
diff --git a/x2goserver.spec b/x2goserver.spec
index 5be63f0..70134b1 100644
--- a/x2goserver.spec
+++ b/x2goserver.spec
@@ -1,7 +1,7 @@
 #global checkout 20130722git65169c9
 Name:           x2goserver
 Version:        4.0.1.8
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        X2Go server daemon scripts
 
 Group:          Applications/Communications
@@ -17,6 +17,8 @@ Source2:        x2gocleansessions.init
 
 # Use pwgen instead of makepasswd which is not in Fedora
 Patch0:         x2goserver-pwgen.patch
+# Use mktemp instead of tempfile
+Patch1:         x2goserver-mktemp.patch
 
 BuildRequires:  perl(ExtUtils::MakeMaker)
 %if 0%{?fedora}
@@ -81,6 +83,7 @@ server).
 %prep
 %setup -q
 %patch0 -p1 -b .pwgen
+%patch1 -p1 -b .mktemp
 
 # Set pach
 #find -type f | xargs sed -i -r -e '/^((LIBDIR|X2GO_LIB_PATH)=|use lib|my \$x2go_lib_path)/s,/lib/,/%{_lib}/,'
@@ -221,6 +224,9 @@ exit 0
 %attr(0700,x2goprint,x2goprint) %{_localstatedir}/spool/x2goprint
 
 %changelog
+* Wed Nov 27 2013 Orion Poplawski <orion at cora.nwra.com> - 4.0.1.8-2
+- Use mktemp instead of tempfile
+
 * Sat Nov 23 2013 Orion Poplawski <orion at cora.nwra.com> - 4.0.1.8-1
 - Update to 4.0.1.8
 - Fix x2gocleansessions init script for EL6 (bug #1031150)


More information about the scm-commits mailing list