Commit | Line | Data |
---|---|---|
99c3da2c FF |
1 | diff -u -r ../dpkg-1.18.2/src/archives.c ./src/archives.c |
2 | --- ../dpkg-1.18.2/src/archives.c 2015-07-13 09:53:37.000000000 -0400 | |
3 | +++ ./src/archives.c 2015-08-25 17:59:35.594992908 -0400 | |
4 | @@ -352,8 +352,10 @@ | |
59f0d218 FF |
5 | namenode->statoverride->uid, |
6 | namenode->statoverride->gid, | |
7 | namenode->statoverride->mode); | |
8 | +#ifndef __ANDROID__ | |
9 | if (fchown(fd, st->uid, st->gid)) | |
99c3da2c | 10 | ohshite(_("error setting ownership of '%.255s'"), te->name); |
59f0d218 FF |
11 | +#endif |
12 | if (fchmod(fd, st->mode & ~S_IFMT)) | |
99c3da2c | 13 | ohshite(_("error setting permissions of '%.255s'"), te->name); |
59f0d218 | 14 | |
99c3da2c | 15 | @@ -465,11 +467,15 @@ |
59f0d218 FF |
16 | return; /* Already handled using the file descriptor. */ |
17 | ||
18 | if (te->type == TAR_FILETYPE_SYMLINK) { | |
19 | +#ifndef __ANDROID__ | |
20 | if (lchown(path, st->uid, st->gid)) | |
99c3da2c | 21 | ohshite(_("error setting ownership of symlink '%.255s'"), path); |
59f0d218 FF |
22 | +#endif |
23 | } else { | |
24 | +#ifndef __ANDROID__ | |
25 | if (chown(path, st->uid, st->gid)) | |
99c3da2c | 26 | ohshite(_("error setting ownership of '%.255s'"), path); |
59f0d218 FF |
27 | +#endif |
28 | if (chmod(path, st->mode & ~S_IFMT)) | |
99c3da2c | 29 | ohshite(_("error setting permissions of '%.255s'"), path); |
59f0d218 | 30 | } |
99c3da2c | 31 | @@ -1022,14 +1028,19 @@ |
59f0d218 FF |
32 | varbuf_end_str(&symlinkfn); |
33 | if (symlink(symlinkfn.buf,fnametmpvb.buf)) | |
99c3da2c | 34 | ohshite(_("unable to make backup symlink for '%.255s'"), ti->name); |
59f0d218 FF |
35 | +#ifndef __ANDROID__ |
36 | if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid)) | |
99c3da2c | 37 | ohshite(_("unable to chown backup symlink for '%.255s'"), ti->name); |
59f0d218 FF |
38 | +#endif |
39 | tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode); | |
40 | } else { | |
41 | debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup"); | |
99c3da2c | 42 | + /* Termux modification: Try with rename(2) for systems not supporting hardlinks. */ |
9fbdefb9 | 43 | if (link(fnamevb.buf,fnametmpvb.buf)) |
99c3da2c | 44 | - ohshite(_("unable to make backup link of '%.255s' before installing new version"), |
9fbdefb9 | 45 | - ti->name); |
99c3da2c FF |
46 | + if (rename(fnamevb.buf,fnametmpvb.buf)) { |
47 | + ohshite(_("unable to make backup link of '%.255s' before installing new version"), | |
48 | + ti->name); | |
49 | + } | |
9fbdefb9 FF |
50 | } |
51 | } | |
52 |