From eba74d1a22fb8f939501e86cc48c84b1fc477d12 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 28 May 2023 19:29:23 -0400 Subject: opk/write: Handle specials overrides --- diff --git a/src/opk/write.c b/src/opk/write.c index 1561e38..2986ae0 100644 --- a/src/opk/write.c +++ b/src/opk/write.c @@ -32,6 +32,7 @@ #include "../gzip.h" #include "../i18n.h" #include "../opk.h" +#include "../specials.h" #include "../ustar.h" #include "opk.h" @@ -100,6 +101,9 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, * overflow, not for NUL */ char link[OPKG_OPK_USTAR_LINKNAME_SIZE]; ssize_t link_len; + char type; + uint32_t devmajor; + uint32_t devminor; FILE *fp; char *buffer; size_t size; @@ -211,6 +215,24 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, goto err; } } else if (S_ISREG(st.st_mode)) { + if (opkg_opk_specials_find(opk->specials, + opk->path_virt, &type, + &devmajor, &devminor) == + OPKG_OPK_OK) { + if (opkg_opk_ustar_write_header( + opk->inner_ustar, + &child, + st.st_mode & 0777, + uid, uname, gid, gname, + devmajor, devminor, 0, + opk->mtime, type, NULL) + != OPKG_OPK_OK) { + fputs(_("Error: Failed to write header" + "\n"), stderr); + goto err; + } + continue; + } if (opkg_opk_ustar_write_header(opk->inner_ustar, &child, st.st_mode & 0777, uid, uname, gid, gname, 0, 0, -- cgit v0.9.1