From 1eb8029e60f06e43581fe1d3a504a808ff4d0dc0 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 2 Feb 2009 21:10:21 +0100 Subject: [PATCH] Some enhancements about xattr API. --- libisofs/libisofs.h | 1 + libisofs/node.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 5bc59c1..d356af1 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -4372,6 +4372,7 @@ int iso_node_set_acl_text(IsoNode *node, * @param flag * Bitfield for control purposes * bit0= obtain eventual ACLs as attribute with empty name + * bit2= with bit0: do not obtain attributes other than ACLs * bit15= free memory * @return * 1 = ok (but *num_attrs may be 0) diff --git a/libisofs/node.c b/libisofs/node.c index 17e888b..2507c98 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -1353,6 +1353,7 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev, /* ts A90202 */ +/* @param flag bit0= inverse: cleanout everything but del_name static int attrs_cleanout_name(char *del_name, size_t *num_attrs, char **names, size_t *value_lengths, char **values, int flag) @@ -1360,7 +1361,7 @@ int attrs_cleanout_name(char *del_name, size_t *num_attrs, char **names, size_t i, w; for (w = i = 0; i < *num_attrs; i++) { - if (strcmp(names[i], del_name) == 0) + if ((strcmp(names[i], del_name) == 0) ^ (flag & 1)) continue; if (w == i) { w++; @@ -1441,8 +1442,9 @@ int iso_node_get_attrs(IsoNode *node, size_t *num_attrs, return ISO_AAIP_BAD_AASTRING; } if (!(flag & 1)) { - /* Clean out eventual ACL attribute */ - attrs_cleanout_name("", num_attrs, *names, *value_lengths, *values, 0); + /* Clean out eventual ACL attribute resp. all other xattr */ + attrs_cleanout_name("", num_attrs, *names, *value_lengths, *values, + !!(flag & 4)); }