chiark / gitweb /
tcl: Update from 8.6.5 to 8.6.6
[termux-packages] / packages / apt / contrib-fileutl.cc.patch
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-04 07:11:09.531546721 -0500
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  #include <pwd.h>
12  #include <grp.h>
13  
14 @@ -100,7 +102,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 @@ -2102,6 +2104,7 @@
24  std::vector<std::string> Glob(std::string const &pattern, int flags)
25  {
26     std::vector<std::string> result;
27 +#ifndef __ANDROID__
28     glob_t globbuf;
29     int glob_res;
30     unsigned int i;
31 @@ -2121,6 +2124,7 @@
32        result.push_back(string(globbuf.gl_pathv[i]));
33  
34     globfree(&globbuf);
35 +#endif
36     return result;
37  }
38                                                                         /*}}}*/
39 @@ -2136,10 +2140,10 @@
40     struct stat st;
41     if (!tmpdir || strlen(tmpdir) == 0 || // tmpdir is set
42          stat(tmpdir, &st) != 0 || (st.st_mode & S_IFDIR) == 0) // exists and is directory
43 -      tmpdir = "/tmp";
44 +      tmpdir = "@TERMUX_PREFIX@/tmp";
45     else if (geteuid() != 0 && // root can do everything anyway
46          faccessat(-1, tmpdir, R_OK | W_OK | X_OK, AT_EACCESS | AT_SYMLINK_NOFOLLOW) != 0) // current user has rwx access to directory
47 -      tmpdir = "/tmp";
48 +      tmpdir = "@TERMUX_PREFIX@/tmp";
49  
50     return string(tmpdir);
51  }