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(action);
if (strcmp(xhp->rootdir, "/") == 0) {
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
tmpdir = P_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) {