diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-28 19:29:23 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-28 19:29:23 (EDT) |
commit | eba74d1a22fb8f939501e86cc48c84b1fc477d12 (patch) | |
tree | aea7be7f714190e1b519414dc7ae75a11c67ec7c | |
parent | 1396a2142e39b1a23ba62328cb0cf1bd132a351d (diff) |
opk/write: Handle specials overrides
-rw-r--r-- | src/opk/write.c | 22 |
1 files changed, 22 insertions, 0 deletions
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, |