allow writing attributes with write-only perms

* replace "r+" with "w" in fopen() flags to avoid EACCES when
opening attribute files with no read permission.
Merge pull request #1 from gizero/fix-EACCES-in-local_write_dev_attr

allow writing attributes with write-only perms
iio_device_attr_write_*: fix return value

make these functions return 0 on success instead of the number of
bytes written in accordance with the API
iio_device_debug_attr_write_*: fix return value

make these functions return 0 on success instead of the number of
bytes written, in accordance with the API
iio_device_reg_write: fix return value

make the functions return 0 on success instead of the number of
bytes written, in accordance with the API
iio_channel_convert(): Mask upper bits

The value for bits in the raw word above the number of real data bits is
undefined and may contain garbage. We need to mask those bytes out when
converting the value to make sure that those upper bits do not leak.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
get_short_attr_name(): Handle channels with modifiers

For channels with modifiers we need to strip the first three instead of the
first two elements to get the short name.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Merge pull request #2 from gizero/fix-return-values-attribute-writes

Fix return values attribute writes
Merge branch 'master' into 2014_R1