summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-05-07 05:31:24 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-05-07 07:30:53 (EDT)
commit757f6e4d2dd1df1a89c425200b15753d606e3748 (patch)
treedb32b32a9bfdc2ed870a0c60a6b3c68600bf3377
parenta53a4e673758d38d2120391ce31c5cffaf2b3cb5 (diff)
opk/write: Store outer ustar uname/gname in vars
-rw-r--r--src/opk/write.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/opk/write.c b/src/opk/write.c
index 2f2d03e..a00cf77 100644
--- a/src/opk/write.c
+++ b/src/opk/write.c
@@ -52,6 +52,8 @@ opkg_opk_opk_write(struct opkg_opk_opk *opk, const char *file_name)
{
int ret;
uint64_t mtime;
+ char *uname;
+ char *gname;
struct opkg_opk_dirent dirent;
char *buffer;
size_t size;
@@ -90,13 +92,15 @@ opkg_opk_opk_write(struct opkg_opk_opk *opk, const char *file_name)
goto out2;
}
+ uname = getpwuid(0)->pw_name;
+ gname = getgrgid(0)->gr_name;
+
/* Write version file. */
dirent.name = "debian-binary";
dirent.parent = NULL;
if (opkg_opk_ustar_write_header(opk->outer_ustar, &dirent, 0644,
- 0, getpwuid(0)->pw_name,
- 0, getgrgid(0)->gr_name,
- 4, mtime, '-', NULL) != OPKG_OPK_OK) {
+ 0, uname, 0, gname, 4, mtime, '-', NULL) !=
+ OPKG_OPK_OK) {
fputs(_("Error: Failed to write header\n"), stderr);
ret = OPKG_OPK_ERROR;
goto out3;