diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-12 12:41:13 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-05-12 12:41:13 (EDT) |
commit | f7237d88bcfbede42da49000f846a913a1fc1fd5 (patch) | |
tree | 282ecb36a2cc58dbcb45a734185c767dbdd001e8 /src | |
parent | 2768add93eed4c287ed89f5cbad1af790d938c6e (diff) |
ustar: Provide devmajor and devminor in listing
Diffstat (limited to 'src')
-rw-r--r-- | src/ustar.c | 15 | ||||
-rw-r--r-- | src/ustar.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ustar.c b/src/ustar.c index 669596e..8a0a43c 100644 --- a/src/ustar.c +++ b/src/ustar.c @@ -178,7 +178,8 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar, return OPKG_OPK_ERROR; } - /* Set name, mode, size, mtime, type, linkname, uname, and gname. */ + /* Set name, mode, size, mtime, type, linkname, uname, gname, devmajor, + * and devminor. */ if (ustar->header.prefix[0] != '\0') { sprintf((*member)->name, "%s/%s", ustar->header.prefix, ustar->header.name); @@ -237,6 +238,18 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar, sizeof((*member)->uname)); strncpy((*member)->gname, ustar->header.gname, sizeof((*member)->gname)); + (*member)->devmajor = strtol(ustar->header.devmajor, &end, + OPKG_OPK_USTAR_NUM_BASE_); + if (*end != '\0') { + free(*member); + return OPKG_OPK_ERROR; + } + (*member)->devminor = strtol(ustar->header.devminor, &end, + OPKG_OPK_USTAR_NUM_BASE_); + if (*end != '\0') { + free(*member); + return OPKG_OPK_ERROR; + } return OPKG_OPK_OK; /* Possibly more members in archive */ } diff --git a/src/ustar.h b/src/ustar.h index 19e6422..5431819 100644 --- a/src/ustar.h +++ b/src/ustar.h @@ -40,6 +40,8 @@ struct opkg_opk_ustar_member { char linkname[OPKG_OPK_USTAR_LINKNAME_SIZE]; char uname [32]; char gname [32]; + uint32_t devmajor; + uint32_t devminor; struct opkg_opk_ustar_member *next; }; |