From 4b063b0017ff262e3d6757062a297082a808a3e2 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 14 Dec 2019 23:49:40 +0100 Subject: Fix minor bug in plugin path setup --- TODO | 6 +++--- midimonster.h | 2 +- plugin.c | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 1f1269d..6ee649f 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,8 @@ keepalive channels per backend? Note source in channel value struct 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... diff --git a/midimonster.h b/midimonster.h index 1f5c936..eb19409 100644 --- a/midimonster.h +++ b/midimonster.h @@ -92,7 +92,7 @@ struct _managed_fd; * Parse instance configuration from the user-supplied configuration * file. Returning a non-zero value fails config parsing. * * mmbackend_channel - * Parse a channel-spec to be mapped to/from. The `falgs` parameter supplies + * Parse a channel-spec to be mapped to/from. The `flags` parameter supplies * additional information to the parser, such as whether the channel is being * queried for use as input (to the MIDIMonster core) and/or output * (from the MIDIMonster core) channel (on a per-query basis). diff --git a/plugin.c b/plugin.c index c7c9812..56d6651 100644 --- a/plugin.c +++ b/plugin.c @@ -30,6 +30,11 @@ static int plugin_attach(char* path, char* file){ char* path_separator = "/"; #endif + if(!path || !file || !strlen(path)){ + fprintf(stderr, "Invalid plugin loader path\n"); + return 1; + } + lib = calloc(strlen(path) + strlen(file) + 2, sizeof(char)); if(!lib){ fprintf(stderr, "Failed to allocate memory\n"); @@ -37,7 +42,7 @@ static int plugin_attach(char* path, char* file){ } snprintf(lib, strlen(path) + strlen(file) + 2, "%s%s%s", path, - (path[strlen(path)] == path_separator[0]) ? "" : path_separator, + (path[strlen(path) - 1] == path_separator[0]) ? "" : path_separator, file); handle = dlopen(lib, RTLD_NOW); -- cgit v1.2.3