summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2012-08-06 13:31:20 +0200
committerAndreas Gruenbacher <agruen@linbit.com>2013-05-28 15:37:30 +0200
commitfeaf46e9a95cec83c6300649fabd3be9ad508e20 (patch)
treeecea68cc5333de89514d90b8cefe71128be263fb
parentd33cba834ba834af32dea4993ca1eeecebffae07 (diff)
downloadattr-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.c12
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;
}