chiark / gitweb /
debianutils: Update from 4.8.3 to 4.8.4
[termux-packages] / packages / global / libutil-makepath.c.patch
1 diff -u -r ../global-6.5.2/libutil/makepath.c ./libutil/makepath.c
2 --- ../global-6.5.2/libutil/makepath.c  2015-12-16 00:02:48.000000000 -0500
3 +++ ./libutil/makepath.c        2015-12-25 21:36:31.333892462 -0500
4 @@ -122,6 +122,9 @@
5                  * ~/dir/...
6                  */
7                 if (*++file == '/') {
8 +#ifdef __ANDROID__
9 +                       return makepath("@TERMUX_HOME@", file, NULL);
10 +#else
11                         uid_t uid;
12                         file++;
13                         uid = getuid();
14 @@ -129,11 +132,15 @@
15                                 if (pw->pw_uid == uid)
16                                         break;
17                         }
18 +#endif
19                 }
20                 /*
21                  * ~user/dir/...
22                  */
23                 else {
24 +#ifdef __ANDROID__
25 +                       pw = NULL;
26 +#else
27                         const char *name = strmake(file, "/");
28                         file = locatestring(file, "/", MATCH_FIRST);
29                         if (file != NULL)
30 @@ -144,12 +151,15 @@
31                                 if (!strcmp(pw->pw_name, name))
32                                         break;
33                         }
34 +#endif
35                 }
36                 if (errno)
37                         die("cannot open passwd file. (errno = %d)", errno);
38                 if (pw == NULL)
39                         die("home directory not found.");
40 +#ifndef __ANDROID__
41                 endpwent();
42 +#endif
43                 return makepath(pw->pw_dir, file, NULL);
44         /*
45          * absolute path