diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2012-08-06 13:31:20 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@linbit.com> | 2013-05-28 15:37:30 +0200 |
commit | feaf46e9a95cec83c6300649fabd3be9ad508e20 (patch) | |
tree | ecea68cc5333de89514d90b8cefe71128be263fb | |
parent | d33cba834ba834af32dea4993ca1eeecebffae07 (diff) | |
download | attr-feaf46e9a95cec83c6300649fabd3be9ad508e20.tar.gz |
Fix ATTR_OP_REMOVE operation in attr_multi()
The ATTR_OP_GET, ATTR_OP_SET, and ATTR_OP_REMOVE constants are not single bit
values, so use comparisons instead of bit tests to check which of those
operations to perform. (Up to now, ATTR_OP_REMOVE was wrongly detected as
ATTR_OP_GET.)
-rw-r--r-- | libattr/libattr.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libattr/libattr.c b/libattr/libattr.c index e343155..4582e27 100644 --- a/libattr/libattr.c +++ b/libattr/libattr.c @@ -363,13 +363,13 @@ attr_single(const char *path, attr_multiop_t *op, int flags) errno = -EINVAL; flags |= op->am_flags; - if (op->am_opcode & ATTR_OP_GET) + if (op->am_opcode == ATTR_OP_GET) r = attr_get(path, op->am_attrname, op->am_attrvalue, &op->am_length, flags); - else if (op->am_opcode & ATTR_OP_SET) + else if (op->am_opcode == ATTR_OP_SET) r = attr_set(path, op->am_attrname, op->am_attrvalue, op->am_length, flags); - else if (op->am_opcode & ATTR_OP_REMOVE) + else if (op->am_opcode == ATTR_OP_REMOVE) r = attr_remove(path, op->am_attrname, flags); return r; } @@ -381,13 +381,13 @@ attr_singlef(const int fd, attr_multiop_t *op, int flags) errno = -EINVAL; flags |= op->am_flags; - if (op->am_opcode & ATTR_OP_GET) + if (op->am_opcode == ATTR_OP_GET) r = attr_getf(fd, op->am_attrname, op->am_attrvalue, &op->am_length, flags); - else if (op->am_opcode & ATTR_OP_SET) + else if (op->am_opcode == ATTR_OP_SET) r = attr_setf(fd, op->am_attrname, op->am_attrvalue, op->am_length, flags); - else if (op->am_opcode & ATTR_OP_REMOVE) + else if (op->am_opcode == ATTR_OP_REMOVE) r = attr_removef(fd, op->am_attrname, flags); return r; } |