termux-packages/packages/busybox/0007-miscutils-crontab.patch
Henrik Grimler 218a206274 busybox: fix build with ndk r23
Compiler and tool names need to be updated in Makefile.

Also fix some patch offsets while we are at it
2021-10-22 23:05:45 +02:00

41 lines
1.2 KiB
Diff

diff -uNr busybox-1.33.1/miscutils/crontab.c busybox-1.33.1.mod/miscutils/crontab.c
--- busybox-1.33.1/miscutils/crontab.c 2021-01-01 10:52:27.000000000 +0000
+++ busybox-1.33.1.mod/miscutils/crontab.c 2021-05-04 14:17:52.387444315 +0000
@@ -51,12 +51,14 @@
return;
}
+#ifndef __ANDROID__
/* CHILD - change user and run editor */
/* initgroups, setgid, setuid */
change_identity(pas);
setup_environment(pas->pw_shell,
SETUP_ENV_CHANGEENV | SETUP_ENV_TO_TMP,
pas);
+#endif
ptr = getenv("VISUAL");
if (!ptr) {
ptr = getenv("EDITOR");
@@ -129,7 +131,11 @@
if (!argv[0])
bb_show_usage();
if (NOT_LONE_DASH(argv[0])) {
+#ifndef __ANDROID__
src_fd = xopen_as_uid_gid(argv[0], O_RDONLY, pas->pw_uid, pas->pw_gid);
+#else
+ src_fd = xopen3(argv[0], O_RDONLY, 0600);
+#endif
}
}
@@ -158,7 +164,9 @@
/* No O_EXCL: we don't want to be stuck if earlier crontabs
* were killed, leaving stale temp file behind */
src_fd = xopen3(tmp_fname, O_RDWR|O_CREAT|O_TRUNC, 0600);
+#ifndef __ANDROID__
fchown(src_fd, pas->pw_uid, pas->pw_gid);
+#endif
fd = open(pas->pw_name, O_RDONLY);
if (fd >= 0) {
bb_copyfd_eof(fd, src_fd);