diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-05-15 20:11:56 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-05-16 16:54:44 +0200 |
commit | 9a97a9a4fe224bcf53ad23af31bca67bbb71a824 (patch) | |
tree | bf1bd2ba581f8816813e6d17aa7e569b7b89cd1b /bin/sqfs2tar/src/xattr.c | |
parent | f5377528d4897e42fafe6c88ce550c956b0d85be (diff) |
libtar: replace tar_xattr_t with dir_entry_xattr_t struct
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/sqfs2tar/src/xattr.c')
-rw-r--r-- | bin/sqfs2tar/src/xattr.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/bin/sqfs2tar/src/xattr.c b/bin/sqfs2tar/src/xattr.c index abec4fb..8d21cd8 100644 --- a/bin/sqfs2tar/src/xattr.c +++ b/bin/sqfs2tar/src/xattr.c @@ -6,32 +6,25 @@ */ #include "sqfs2tar.h" -static tar_xattr_t *mkxattr(const sqfs_xattr_entry_t *key, - const sqfs_xattr_value_t *value) +static dir_entry_xattr_t *mkxattr(const sqfs_xattr_entry_t *key, + const sqfs_xattr_value_t *value) { - tar_xattr_t *ent; - - ent = calloc(1, sizeof(*ent) + strlen((const char *)key->key) + - value->size + 2); + dir_entry_xattr_t *ent; + ent = dir_entry_xattr_create((const char *)key->key, + value->value, value->size); if (ent == NULL) { perror("creating xattr entry"); return NULL; } - ent->key = ent->data; - ent->value = (sqfs_u8 *)ent->key + strlen((const char *)key->key) + 1; - ent->value_len = value->size; - - strcpy(ent->key, (const char *)key->key); - memcpy(ent->value, value->value, value->size + 1); return ent; } int get_xattrs(const char *name, const sqfs_inode_generic_t *inode, - tar_xattr_t **out) + dir_entry_xattr_t **out) { - tar_xattr_t *list = NULL, *ent; + dir_entry_xattr_t *list = NULL, *ent; sqfs_xattr_value_t *value; sqfs_xattr_entry_t *key; sqfs_xattr_id_t desc; @@ -86,6 +79,6 @@ int get_xattrs(const char *name, const sqfs_inode_generic_t *inode, *out = list; return 0; fail: - free_xattr_list(list); + dir_entry_xattr_list_free(list); return -1; } |