From f7237d88bcfbede42da49000f846a913a1fc1fd5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 12 May 2023 12:41:13 -0400 Subject: ustar: Provide devmajor and devminor in listing --- (limited to 'src') 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; }; -- cgit v0.9.1