diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-12 23:21:09 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-05 13:55:08 +0100 |
commit | 665dfe93185a1decdb422f9e5b65a7e39415f129 (patch) | |
tree | 266e268f0345f01e13ffd9b46800beba172f73c1 /src/libudev | |
parent | 7c59ab4ba11f7ac2afc3dc4f3ba9c97b72c34750 (diff) | |
download | systemd-665dfe93185a1decdb422f9e5b65a7e39415f129.tar.gz |
io-util: make flush_fd() return how many bytes where flushed
This is useful so that callers know whether anything at all and how much
was flushed.
This patches through users of this functions to ensure that the return
values > 0 which may be returned now are not propagated in public APIs.
Also, users that ignore the return value are changed to do so explicitly
now.
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/libudev-queue.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c index b941afb773..85ceb263a3 100644 --- a/src/libudev/libudev-queue.c +++ b/src/libudev/libudev-queue.c @@ -268,8 +268,16 @@ _public_ int udev_queue_get_fd(struct udev_queue *udev_queue) { * Returns: the result of clearing the watch for queue changes. */ _public_ int udev_queue_flush(struct udev_queue *udev_queue) { + int r; + + assert(udev_queue); + if (udev_queue->fd < 0) return -EINVAL; - return flush_fd(udev_queue->fd); + r = flush_fd(udev_queue->fd); + if (r < 0) + return r; + + return 0; } |