From 88ae0750d479345ef088015d219d9fd49c182319 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 12 May 2023 12:18:38 -0400 Subject: opk/write: Write block, char, and FIFO headers --- (limited to 'src/opk/write.c') diff --git a/src/opk/write.c b/src/opk/write.c index b9e50c7..7968ff4 100644 --- a/src/opk/write.c +++ b/src/opk/write.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "../defs.h" #include "../dirent.h" @@ -186,11 +187,42 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, goto out1; } } else if (S_ISCHR(st.st_mode)) { - /* TODO */ + if (opkg_opk_ustar_write_header(opk->inner_ustar, + &child, st.st_mode & 0777, + uid, uname, gid, gname, + major(st.st_rdev), + minor(st.st_rdev), + 0, opk->mtime, 'c', NULL) != + OPKG_OPK_OK) { + fputs(_("Error: Failed to write header\n"), + stderr); + ret = OPKG_OPK_ERROR; + goto out1; + } } else if (S_ISBLK(st.st_mode)) { - /* TODO */ + if (opkg_opk_ustar_write_header(opk->inner_ustar, + &child, st.st_mode & 0777, + uid, uname, gid, gname, + major(st.st_rdev), + minor(st.st_rdev), + 0, opk->mtime, 'b', NULL) != + OPKG_OPK_OK) { + fputs(_("Error: Failed to write header\n"), + stderr); + ret = OPKG_OPK_ERROR; + goto out1; + } } else if (S_ISFIFO(st.st_mode)) { - /* TODO */ + if (opkg_opk_ustar_write_header(opk->inner_ustar, + &child, st.st_mode & 0777, + uid, uname, gid, gname, 0, 0, 0, + opk->mtime, 'p', NULL) != + OPKG_OPK_OK) { + fputs(_("Error: Failed to write header\n"), + stderr); + ret = OPKG_OPK_ERROR; + goto out1; + } } else if (S_ISREG(st.st_mode)) { if (opkg_opk_ustar_write_header(opk->inner_ustar, &child, -- cgit v0.9.1