[PATCH evemu 19/19] Make evemu_play_one() return negative value on error
Daniel Martin
consume.noise at gmail.com
Mon Jan 6 09:38:19 PST 2014
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 at gmail.com>
---
src/evemu.c | 2 +-
src/evemu.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
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);
--
1.8.5.2
More information about the Input-tools
mailing list