[PATCH evemu] evemu-record.c: Fix evemu-describe writing to output file

Martin Kepplinger martink at posteo.de
Fri Sep 15 09:34:08 UTC 2017


We had incremented the argv pointer once too often here. What was read
is some buffer outside of our scope, not the next argument after the
device. Right before, "prefix" is already set up to point to the user's
output file path. Let's use it.

I guess people work around and always use redirection of stdout in order
to get a file instead. This makes writing directly work.

Signed-off-by: Martin Kepplinger <martink at posteo.de>
---
 tools/evemu-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/evemu-record.c b/tools/evemu-record.c
index 998f63d..ecb8865 100644
--- a/tools/evemu-record.c
+++ b/tools/evemu-record.c
@@ -322,7 +322,7 @@ int main(int argc, char *argv[])
 
 	} else if (mode == EVEMU_DESCRIBE) {
 		if (prefix) {
-			output = fopen(argv[optind++], "w");
+			output = fopen(prefix, "w");
 			if (!output) {
 				fprintf(stderr, "error: could not open output file (%m)\n");
 				goto out;
-- 
2.11.0



More information about the Input-tools mailing list