xbps_pkg_exec_buffer: if rootdir != / create tmp files on rootdir.

This commit is contained in:
Juan RP 2012-11-17 12:08:25 +01:00
parent 0a082a82c3
commit cc99e887a2

View File

@ -50,11 +50,15 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
assert(version); assert(version);
assert(action); assert(action);
tmpdir = getenv("TMPDIR"); if (strcmp(xhp->rootdir, "/") == 0) {
if (tmpdir == NULL) tmpdir = getenv("TMPDIR");
tmpdir = P_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 */ /* Create temp file to run script */
if ((fd = mkstemp(fpath)) == -1) { if ((fd = mkstemp(fpath)) == -1) {