summaryrefslogtreecommitdiff
path: root/src/archive.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-09-23 15:44:46 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-09-23 15:44:46 +0300
commit28745420d037e6b7eec9e9db57e4b0f54247a3e6 (patch)
tree4edf531e389bf0867d4fbdffef47f3c9d99124b7 /src/archive.c
parent5c4583a9027de2a26d3bff8b443f7db7f0c37074 (diff)
downloadapk-tools-28745420d037e6b7eec9e9db57e4b0f54247a3e6.tar.gz
apk-tools-28745420d037e6b7eec9e9db57e4b0f54247a3e6.tar.bz2
apk-tools-28745420d037e6b7eec9e9db57e4b0f54247a3e6.tar.xz
apk-tools-28745420d037e6b7eec9e9db57e4b0f54247a3e6.zip
archive: resolve uid, gid for file information
the uid and gid are used in other places than just changing file ownership on extraction.
Diffstat (limited to 'src/archive.c')
-rw-r--r--src/archive.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/archive.c b/src/archive.c
index 3ac8a64..b60b3b2 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -146,8 +146,8 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser,
entry = (struct apk_file_info){
.size = GET_OCTAL(buf.size),
- .uid = GET_OCTAL(buf.uid),
- .gid = GET_OCTAL(buf.gid),
+ .uid = apk_resolve_uid(buf.uname, GET_OCTAL(buf.uid)),
+ .gid = apk_resolve_gid(buf.gname, GET_OCTAL(buf.gid)),
.mode = GET_OCTAL(buf.mode) & 07777,
.mtime = GET_OCTAL(buf.mtime),
.name = entry.name,
@@ -389,10 +389,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
break;
}
if (r == 0) {
- r = fchownat(atfd, fn,
- apk_resolve_uid(ae->uname, ae->uid),
- apk_resolve_gid(ae->gname, ae->gid),
- atflags);
+ r = fchownat(atfd, fn, ae->uid, ae->gid, atflags);
if (r < 0) {
apk_error("Failed to set ownership on %s: %s",
fn, strerror(errno));