52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
diff -u -r ../dpkg-1.17.25/src/archives.c ./src/archives.c
|
|
--- ../dpkg-1.17.25/src/archives.c 2015-04-09 17:40:47.000000000 -0400
|
|
+++ ./src/archives.c 2015-07-09 20:56:04.604894782 -0400
|
|
@@ -359,8 +359,10 @@
|
|
namenode->statoverride->uid,
|
|
namenode->statoverride->gid,
|
|
namenode->statoverride->mode);
|
|
+#ifndef __ANDROID__
|
|
if (fchown(fd, st->uid, st->gid))
|
|
ohshite(_("error setting ownership of `%.255s'"), te->name);
|
|
+#endif
|
|
if (fchmod(fd, st->mode & ~S_IFMT))
|
|
ohshite(_("error setting permissions of `%.255s'"), te->name);
|
|
|
|
@@ -472,11 +474,15 @@
|
|
return; /* Already handled using the file descriptor. */
|
|
|
|
if (te->type == TAR_FILETYPE_SYMLINK) {
|
|
+#ifndef __ANDROID__
|
|
if (lchown(path, st->uid, st->gid))
|
|
ohshite(_("error setting ownership of symlink `%.255s'"), path);
|
|
+#endif
|
|
} else {
|
|
+#ifndef __ANDROID__
|
|
if (chown(path, st->uid, st->gid))
|
|
ohshite(_("error setting ownership of `%.255s'"), path);
|
|
+#endif
|
|
if (chmod(path, st->mode & ~S_IFMT))
|
|
ohshite(_("error setting permissions of `%.255s'"), path);
|
|
}
|
|
@@ -1148,14 +1154,18 @@
|
|
varbuf_end_str(&symlinkfn);
|
|
if (symlink(symlinkfn.buf,fnametmpvb.buf))
|
|
ohshite(_("unable to make backup symlink for `%.255s'"), ti->name);
|
|
+#ifndef __ANDROID__
|
|
if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
|
|
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");
|
|
if (link(fnamevb.buf,fnametmpvb.buf))
|
|
- ohshite(_("unable to make backup link of `%.255s' before installing new version"),
|
|
- ti->name);
|
|
+ /* Termux modification: Try with rename(2) for systems not supporting hardlinks. */
|
|
+ if (rename(fnamevb.buf,fnametmpvb.buf))
|
|
+ ohshite(_("unable to make backup link of `%.255s' before installing new version"),
|
|
+ ti->name);
|
|
}
|
|
}
|
|
|