From 757f6e4d2dd1df1a89c425200b15753d606e3748 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 07 May 2023 05:31:24 -0400 Subject: opk/write: Store outer ustar uname/gname in vars --- 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; -- cgit v0.9.1