| 1 | diff -u -r ../upstream.git/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc |
| 2 | --- ../upstream.git/apt-pkg/contrib/fileutl.cc 2014-05-05 14:01:59.000000000 +0200 |
| 3 | +++ ./apt-pkg/contrib/fileutl.cc 2014-06-06 00:09:17.233239376 +0200 |
| 4 | @@ -46,7 +46,9 @@ |
| 5 | #include <dirent.h> |
| 6 | #include <signal.h> |
| 7 | #include <errno.h> |
| 8 | +#ifndef __ANDROID__ |
| 9 | #include <glob.h> |
| 10 | +#endif |
| 11 | |
| 12 | #include <set> |
| 13 | #include <algorithm> |
| 14 | @@ -93,7 +95,7 @@ |
| 15 | _exit(100); |
| 16 | } |
| 17 | |
| 18 | - if (chdir("/tmp/") != 0) |
| 19 | + if (chdir("@TERMUX_PREFIX@/tmp/") != 0) |
| 20 | _exit(100); |
| 21 | |
| 22 | unsigned int Count = 1; |
| 23 | @@ -1883,7 +1885,11 @@ |
| 24 | FileFdErrno("read","Unable to read original size of gzipped file"); |
| 25 | return 0; |
| 26 | } |
| 27 | +#ifdef __ANDROID__ |
| 28 | + size = letoh32(size); |
| 29 | +#else |
| 30 | size = le32toh(size); |
| 31 | +#endif |
| 32 | |
| 33 | if (lseek(iFd, oldPos, SEEK_SET) < 0) |
| 34 | { |
| 35 | @@ -1998,6 +2004,7 @@ |
| 36 | std::vector<std::string> Glob(std::string const &pattern, int flags) |
| 37 | { |
| 38 | std::vector<std::string> result; |
| 39 | +#ifndef __ANDROID__ |
| 40 | glob_t globbuf; |
| 41 | int glob_res; |
| 42 | unsigned int i; |
| 43 | @@ -2017,6 +2024,7 @@ |
| 44 | result.push_back(string(globbuf.gl_pathv[i])); |
| 45 | |
| 46 | globfree(&globbuf); |
| 47 | +#endif |
| 48 | return result; |
| 49 | } |
| 50 | /*}}}*/ |
| 51 | @@ -2025,15 +2033,10 @@ |
| 52 | { |
| 53 | const char *tmpdir = getenv("TMPDIR"); |
| 54 | |
| 55 | -#ifdef P_tmpdir |
| 56 | - if (!tmpdir) |
| 57 | - tmpdir = P_tmpdir; |
| 58 | -#endif |
| 59 | - |
| 60 | // check that tmpdir is set and exists |
| 61 | struct stat st; |
| 62 | if (!tmpdir || strlen(tmpdir) == 0 || stat(tmpdir, &st) != 0) |
| 63 | - tmpdir = "/tmp"; |
| 64 | + tmpdir = "@TERMUX_PREFIX@/tmp"; |
| 65 | |
| 66 | return string(tmpdir); |
| 67 | } |