diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/opk/write.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/opk/write.c b/src/opk/write.c index 2ef052f..44629db 100644 --- a/src/opk/write.c +++ b/src/opk/write.c @@ -257,6 +257,11 @@ _opkg_opk_opk_build_inner_archive(struct opkg_opk_opk *opk, { FILE *fp; struct opkg_opk_dirent dirent; + struct stat st; + uid_t uid; + char *uname; + gid_t gid; + char *gname; size_t written; char *buffer; size_t size; @@ -296,6 +301,21 @@ _opkg_opk_opk_build_inner_archive(struct opkg_opk_opk *opk, } else { strcpy(opk->path, opk->data_dir); } + if (stat(opk->path, &st) != 0) { + fprintf(stderr, _("Error: Failed to stat \"%s\"\n"), opk->path); + goto err3; + } + uid = st.st_uid; + uname = getpwuid(uid)->pw_name; + gid = st.st_gid; + gname = getgrgid(gid)->gr_name; + if (opkg_opk_ustar_write_header(opk->inner_ustar, &dirent, + st.st_mode & 0777, uid, uname, gid, gname, 0, + opk->mtime, 'd', NULL) != OPKG_OPK_OK) { + fputs(_("Error: Failed to write header\n"), + stderr); + goto err3; + } if (_opkg_opk_opk_write_dir_read(opk, &dirent) != OPKG_OPK_OK) { goto err3; } |