utf8proc: Update from 2.1.0 to 2.1.1
[termux-packages] / packages / libical / stow.c.patch
1 --- ./src/test/stow.c 2017-11-19 14:32:53.000000000 +0000
2 +++ ../stow.c 2017-12-07 20:41:54.498696535 +0000
3 @@ -572,40 +572,41 @@
4 if (opt->storage == STORE_IN_FILE && opt->output_file == 0) {
5 char file[MAXPATHLEN];
6 char *user = getenv("USER");
7 - struct passwd *pw;
8 + #ifndef __ANDROID__
9 + struct passwd *pw;
10 + #endif
11
12 if (!user) {
13 - fprintf(stderr,
14 - "%s: Can't get username. Try explicitly specifying the output file with -o",
15 - program_name);
16 - exit(1);
17 + user = "TERMUX";
18 }
19
20 /* Find password entry for user */
21 /* cppcheck-suppress getpwentCalled as we don't care about multi-threaded in a test prog */
22 - while ((pw = getpwent()) != 0) {
23 - if (strcmp(user, pw->pw_name) == 0) {
24 - break;
25 + #ifndef __ANDROID__
26 + while ((pw = getpwent()) != 0) {
27 + if (strcmp(user, pw->pw_name) == 0) {
28 + break;
29 + }
30 + }
31 +
32 + if (pw == 0) {
33 + fprintf(stderr,
34 + "%s: Can't get get password entry for user \"%s\" "
35 + "Try explicitly specifying the output file with -o",
36 + program_name, user);
37 + exit(1);
38 }
39 - }
40 -
41 - if (pw == 0) {
42 - fprintf(stderr,
43 - "%s: Can't get get password entry for user \"%s\" "
44 - "Try explicitly specifying the output file with -o",
45 - program_name, user);
46 - exit(1);
47 - }
48
49 - if (pw->pw_dir == 0) {
50 - fprintf(stderr,
51 - "%s: User \"%s\" has no home directory. "
52 - "Try explicitly specifying the output file with -o",
53 - program_name, user);
54 - exit(1);
55 - }
56 + if (pw->pw_dir == 0) {
57 + fprintf(stderr,
58 + "%s: User \"%s\" has no home directory. "
59 + "Try explicitly specifying the output file with -o",
60 + program_name, user);
61 + exit(1);
62 + }
63
64 - snprintf(file, MAXPATHLEN, "%s/.facs/%s", pw->pw_dir, opt->calid);
65 + snprintf(file, MAXPATHLEN, "%s/.facs/%s", pw->pw_dir, opt->calid);
66 + #endif
67
68 opt->output_file = strdup(file);
69 }