summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-10-09 13:35:16 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-16 13:07:16 +0300
commitc270ca4eeaefc43ec471ba0b5383b50f4d34c0b7 (patch)
treeaa7d3b6f09e737646bd62e8d913d3a89f964f28f /src
parente7935e3e67ff8d67f5f9c8e68c1f609bd3fa1860 (diff)
downloadconnman-c270ca4eeaefc43ec471ba0b5383b50f4d34c0b7.tar.gz
connman-c270ca4eeaefc43ec471ba0b5383b50f4d34c0b7.tar.bz2
connman-c270ca4eeaefc43ec471ba0b5383b50f4d34c0b7.zip
rfkill: Return the error when write() fails
Diffstat (limited to 'src')
-rw-r--r--src/rfkill.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rfkill.c b/src/rfkill.c
index 77c5b92c..8d4c90d0 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -165,7 +165,7 @@ int __connman_rfkill_block(enum connman_service_type type, connman_bool_t block)
uint8_t rfkill_type;
struct rfkill_event event;
ssize_t len;
- int fd;
+ int fd, err;
DBG("type %d block %d", type, block);
@@ -183,12 +183,15 @@ int __connman_rfkill_block(enum connman_service_type type, connman_bool_t block)
event.soft = block;
len = write(fd, &event, sizeof(event));
- if (len < 0)
+ if (len < 0) {
connman_error("Failed to change RFKILL state");
+ err = len;
+ } else
+ err = 0;
close(fd);
- return 0;
+ return err;
}
int __connman_rfkill_init(void)