Commit 28745420 authored by Timo Teräs's avatar Timo Teräs

archive: resolve uid, gid for file information

the uid and gid are used in other places than just changing file
ownership on extraction.
parent 5c4583a9
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment