From cc99e887a2f675f59653ead276758b9102610c03 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 17 Nov 2012 12:08:25 +0100 Subject: [PATCH] xbps_pkg_exec_buffer: if rootdir != / create tmp files on rootdir. --- lib/package_script.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/package_script.c b/lib/package_script.c index c3d77a45..a902761b 100644 --- a/lib/package_script.c +++ b/lib/package_script.c @@ -50,11 +50,15 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp, assert(version); assert(action); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL) - tmpdir = P_tmpdir; + if (strcmp(xhp->rootdir, "/") == 0) { + tmpdir = getenv("TMPDIR"); + if (tmpdir == NULL) + tmpdir = P_tmpdir; - fpath = xbps_xasprintf("%s/.xbps-script-XXXXXX", tmpdir); + fpath = xbps_xasprintf("%s/.xbps-script-XXXXXX", tmpdir); + } else { + fpath = strdup(".xbps-script-XXXXXX"); + } /* Create temp file to run script */ if ((fd = mkstemp(fpath)) == -1) {