| 1 | diff -u -r ../apt-1.1.3/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc |
| 2 | --- ../apt-1.1.3/apt-pkg/contrib/fileutl.cc 2015-11-30 03:08:24.000000000 -0500 |
| 3 | +++ ./apt-pkg/contrib/fileutl.cc 2015-12-03 17:43:23.360831115 -0500 |
| 4 | @@ -100,7 +100,7 @@ |
| 5 | _exit(100); |
| 6 | } |
| 7 | |
| 8 | - if (chdir("/tmp/") != 0) |
| 9 | + if (chdir("@TERMUX_PREFIX@/tmp/") != 0) |
| 10 | _exit(100); |
| 11 | |
| 12 | unsigned int Count = 1; |
| 13 | @@ -2102,6 +2102,7 @@ |
| 14 | std::vector<std::string> Glob(std::string const &pattern, int flags) |
| 15 | { |
| 16 | std::vector<std::string> result; |
| 17 | +#ifndef __ANDROID__ |
| 18 | glob_t globbuf; |
| 19 | int glob_res; |
| 20 | unsigned int i; |
| 21 | @@ -2121,6 +2122,7 @@ |
| 22 | result.push_back(string(globbuf.gl_pathv[i])); |
| 23 | |
| 24 | globfree(&globbuf); |
| 25 | +#endif |
| 26 | return result; |
| 27 | } |
| 28 | /*}}}*/ |
| 29 | @@ -2136,10 +2138,10 @@ |
| 30 | struct stat st; |
| 31 | if (!tmpdir || strlen(tmpdir) == 0 || // tmpdir is set |
| 32 | stat(tmpdir, &st) != 0 || (st.st_mode & S_IFDIR) == 0) // exists and is directory |
| 33 | - tmpdir = "/tmp"; |
| 34 | + tmpdir = "@TERMUX_PREFIX@/tmp"; |
| 35 | else if (geteuid() != 0 && // root can do everything anyway |
| 36 | faccessat(-1, tmpdir, R_OK | W_OK | X_OK, AT_EACCESS | AT_SYMLINK_NOFOLLOW) != 0) // current user has rwx access to directory |
| 37 | - tmpdir = "/tmp"; |
| 38 | + tmpdir = "@TERMUX_PREFIX@/tmp"; |
| 39 | |
| 40 | return string(tmpdir); |
| 41 | } |