diff options
author | cbdev <cb@cbcdn.com> | 2019-12-18 22:23:34 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2019-12-18 22:23:34 +0100 |
commit | 886c8e299454176446cce82f151b85a82b26aa06 (patch) | |
tree | d479a000e549d223ee333bed676e01b354dfc97c | |
parent | afed3252dd4b3e3372152c7bef8d2b8ed8cb1af4 (diff) | |
download | midimonster-886c8e299454176446cce82f151b85a82b26aa06.tar.gz midimonster-886c8e299454176446cce82f151b85a82b26aa06.tar.bz2 midimonster-886c8e299454176446cce82f151b85a82b26aa06.zip |
Fix evdev division by zero
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | backends/evdev.c | 3 | ||||
-rw-r--r-- | midimonster.c | 2 |
3 files changed, 6 insertions, 2 deletions
@@ -4,5 +4,6 @@ Optimize core channel search (store backend offset) udp backends may ignore MTU mm_managed_fd.impl is not freed currently (and is heaped most of the time anyway) -> documentation installer: implement an upgrade mode (check for newer versions in the repo) -evdev.c:321 divides by zero with relaxis make event collectors threadsafe to stop marshalling data... +collect & check backend API version +introduce backend logging macro diff --git a/backends/evdev.c b/backends/evdev.c index 659dc77..193b28b 100644 --- a/backends/evdev.c +++ b/backends/evdev.c @@ -208,6 +208,9 @@ static int evdev_configure_instance(instance* inst, char* option, char* value) { data->relative_axis[data->relative_axes].max *= -1; data->relative_axis[data->relative_axes].inverted = 1; } + else if(data->relative_axis[data->relative_axes].max == 0){ + fprintf(stderr, "Relative axis configuration for %s.%s has invalid range\n", inst->name, option + 8); + } data->relative_axis[data->relative_axes].current = strtoul(next_token, NULL, 0); if(data->relative_axis[data->relative_axes].code < 0){ fprintf(stderr, "Failed to configure relative axis extents for %s.%s\n", inst->name, option + 8); diff --git a/midimonster.c b/midimonster.c index 48c6fe9..2ec165b 100644 --- a/midimonster.c +++ b/midimonster.c @@ -224,7 +224,7 @@ static void event_free(){ } static void version(){ - fprintf(stdout, "MIDIMonster %s\n", MIDIMONSTER_VERSION); + printf("MIDIMonster %s\n", MIDIMONSTER_VERSION); } static int usage(char* fn){ |