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

Peter Hutterer peter.hutterer at who-t.net
Sun Sep 17 00:21:22 UTC 2017


On Fri, Sep 15, 2017 at 11:34:08AM +0200, Martin Kepplinger wrote:
> 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
> 

pushed, thanks!

Cheers,
   Peter


More information about the Input-tools mailing list