diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-12 12:18:38 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-12 12:31:18 (EDT) |
commit | 88ae0750d479345ef088015d219d9fd49c182319 (patch) | |
tree | c5434b6b5c5664eefb0306edbcb012da1cea4503 /src | |
parent | 7c30e1432bafd2c8065dddcdb99a46e64e997b18 (diff) |
opk/write: Write block, char, and FIFO headers
Diffstat (limited to 'src')
-rw-r--r-- | src/opk/write.c | 38 |
1 files changed, 35 insertions, 3 deletions
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 <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <sys/sysmacros.h> #include <unistd.h> #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, |