summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Martin <consume.noise@gmail.com>2014-01-06 18:38:19 +0100
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2014-01-07 20:58:23 -0500
commitd14caab0ce3ab3039c6d6a9320e398cf85d7d4e6 (patch)
tree01d0ba58ee5678ff9edd5f3105f8df26440a100b
parente82cd5fe1b7b4a50cc131cb309fb108b1da48e0c (diff)
Make evemu_play_one() return negative value on error
Bring evemu_play_one() in line with other functions and return a negative value on error rather then a positive. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-rw-r--r--src/evemu.c2
-rw-r--r--src/evemu.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/evemu.c b/src/evemu.c
index d279a6c..888ce3c 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -726,7 +726,7 @@ int evemu_play_one(int fd, const struct input_event *ev)
{
int ret;
SYSCALL(ret = write(fd, ev, sizeof(*ev)));
- return (ret == -1 || (size_t)ret < sizeof(*ev));
+ return (ret == -1 || (size_t)ret < sizeof(*ev)) ? -1 : 0;
}
static void evemu_warn_about_incompatible_event(struct input_event *ev)
diff --git a/src/evemu.h b/src/evemu.h
index f438367..44634e8 100644
--- a/src/evemu.h
+++ b/src/evemu.h
@@ -393,6 +393,8 @@ int evemu_record(FILE *fp, int fd, int ms);
* evemu_play_one() - play one event to kernel device
* @fd: file descriptor of kernel device to write to
* @ev: pointer to the kernel event to be played
+ *
+ * Returns zero if successful, negative error otherwise.
*/
int evemu_play_one(int fd, const struct input_event *ev);