termux-packages/packages/dpkg/lib-dpkg-atomic-file.c.patch
Fredrik Fornwall 257b3744d1 dpkg: Do not even try creating hardlinks
We now that it will fail on Android (from 6.0 on), and this only
causes a lot of warning output about denied system call in logcat.
2016-03-16 10:53:16 -04:00

21 lines
772 B
Diff

diff -u -r ../dpkg-1.18.2/lib/dpkg/atomic-file.c ./lib/dpkg/atomic-file.c
--- ../dpkg-1.18.2/lib/dpkg/atomic-file.c 2015-07-12 22:38:47.000000000 -0400
+++ ./lib/dpkg/atomic-file.c 2015-08-25 18:06:51.689715379 -0400
@@ -90,8 +90,14 @@
if (unlink(name_old) && errno != ENOENT)
ohshite(_("error removing old backup file '%s'"), name_old);
- if (link(file->name, name_old) && errno != ENOENT)
- ohshite(_("error creating new backup file '%s'"), name_old);
+#ifdef __ANDROID__
+ /* Termux: Use rename(2) since Android does not support hardlinks. */
+ if (rename(file->name, name_old) && errno != ENOENT) {
+#else
+ if (link(file->name, name_old) && errno != ENOENT) {
+#endif
+ ohshite(_("error creating new backup file '%s'"), name_old);
+ }
free(name_old);
}