termux-packages/packages/dpkg/src-archives.c.patch

76 lines
3.0 KiB
Diff

diff -u -r ../dpkg-1.19.2/src/archives.c ./src/archives.c
--- ../dpkg-1.19.2/src/archives.c 2018-10-08 09:43:48.000000000 +0000
+++ ./src/main/archives.c 2018-11-11 02:17:28.534503365 +0000
@@ -389,9 +389,11 @@
namenode->statoverride->uid,
namenode->statoverride->gid,
namenode->statoverride->mode);
+#ifndef __ANDROID__
rc = fchown(fd, st->uid, st->gid);
if (forcible_nonroot_error(rc))
ohshite(_("error setting ownership of '%.255s'"), te->name);
+#endif
rc = fchmod(fd, st->mode & ~S_IFMT);
if (forcible_nonroot_error(rc))
ohshite(_("error setting permissions of '%.255s'"), te->name);
@@ -506,13 +508,17 @@
return; /* Already handled using the file descriptor. */
if (te->type == TAR_FILETYPE_SYMLINK) {
+#ifndef __ANDROID__
rc = lchown(path, st->uid, st->gid);
if (forcible_nonroot_error(rc))
ohshite(_("error setting ownership of symlink '%.255s'"), path);
+#endif
} else {
+#ifndef __ANDROID__
rc = chown(path, st->uid, st->gid);
if (forcible_nonroot_error(rc))
ohshite(_("error setting ownership of '%.255s'"), path);
+#endif
rc = chmod(path, st->mode & ~S_IFMT);
if (forcible_nonroot_error(rc))
ohshite(_("error setting permissions of '%.255s'"), path);
@@ -552,9 +558,11 @@
else if (linksize > stab->st_size)
ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"),
fn_old, (intmax_t)stab->st_size, linksize);
+#ifndef __ANDROID__
else if (linksize < stab->st_size)
warning(_("symbolic link '%.250s' size has changed from %jd to %zd"),
fn_old, (intmax_t)stab->st_size, linksize);
+#endif
linkname[linksize] = '\0';
if (strcmp(linkname, te->linkname) == 0) {
free(linkname);
@@ -1041,20 +1049,29 @@
else if (r > stab.st_size)
ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"),
fnamevb.buf, (intmax_t)stab.st_size, r);
+#ifndef __ANDROID__
else if (r < stab.st_size)
warning(_("symbolic link '%.250s' size has changed from %jd to %zd"),
fnamevb.buf, (intmax_t)stab.st_size, r);
+#endif
varbuf_trunc(&symlinkfn, r);
varbuf_end_str(&symlinkfn);
if (symlink(symlinkfn.buf,fnametmpvb.buf))
ohshite(_("unable to make backup symlink for '%.255s'"), ti->name);
+#ifndef __ANDROID__
rc = lchown(fnametmpvb.buf, stab.st_uid, stab.st_gid);
if (forcible_nonroot_error(rc))
ohshite(_("unable to chown backup symlink for '%.255s'"), ti->name);
+#endif
tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode);
} else {
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
+#ifdef __ANDROID__
+ /* Android does not support hardlinks. */
+ if (rename(fnamevb.buf,fnametmpvb.buf))
+#else
if (link(fnamevb.buf,fnametmpvb.buf))
+#endif
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
}