summaryrefslogtreecommitdiff
path: root/launchd/privileged_startx/10-tmpdirs.cpp
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-04-27 18:08:50 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-04-27 18:08:50 -0700
commit2f15ccc30479d98012e3ddd595fa13c2f58d4a87 (patch)
tree739ec7a1a815324796aeef88044575eb3e1d03c5 /launchd/privileged_startx/10-tmpdirs.cpp
parent4d0f9d2290bde45c0e844ce40f1caa7fb4baae0f (diff)
privileged_startx: Prefer /usr/bin/mktemp
This will avoid accidentally tripping over an incompatible, user-provided GNU flavor mktemp. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'launchd/privileged_startx/10-tmpdirs.cpp')
-rwxr-xr-xlaunchd/privileged_startx/10-tmpdirs.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/launchd/privileged_startx/10-tmpdirs.cpp b/launchd/privileged_startx/10-tmpdirs.cpp
index e30abac..8012597 100755
--- a/launchd/privileged_startx/10-tmpdirs.cpp
+++ b/launchd/privileged_startx/10-tmpdirs.cpp
@@ -27,10 +27,19 @@ XCOMM promote the sale, use or other dealings in this Software without
XCOMM prior written authorization.
XCOMM Make sure these are owned by root
+
+XCOMM Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
+XCOMM get BSD mktemp
+if [ -x /usr/bin/mktemp ] ; then
+ MKTEMP=/usr/bin/mktemp
+else
+ MKTEMP=mktemp
+fi
+
for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
- # Use mktemp rather than mkdir to avoid possible security issue
- # if $dir exists and is a symlink
- if mktemp -d ${dir} >& /dev/null ; then
+ XCOMM Use mktemp rather than mkdir to avoid possible security issue
+ XCOMM if $dir exists and is a symlink
+ if ${MKTEMP} -d ${dir} >& /dev/null ; then
chmod 1777 $dir
chown root:wheel $dir
fi