From 1036658948230a292ceb0e7688ba05113a14800b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Fri, 25 Aug 2017 13:19:32 +0200 Subject: [PATCH] Add option --no-ldpaths to avoid default ldpaths MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of writing --ldpaths=/dev/null simply use the option --no-ldpaths Change-Id: Ia278989b90a079d998ba0cbb7a6bb78c46d58090 Signed-off-by: José Bollo --- src/afb-config.c | 11 +++++++++-- src/afb-config.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/afb-config.c b/src/afb-config.c index 18f7fa7a..6a91da87 100644 --- a/src/afb-config.c +++ b/src/afb-config.c @@ -69,6 +69,7 @@ #define SET_APITIMEOUT 14 #define SET_CNTXTIMEOUT 15 #define SET_WEAK_LDPATH 16 +#define NO_LDPATH 17 #define SET_MODE 18 @@ -136,7 +137,8 @@ static AFB_options cliOptions[] = { {SET_LDPATH, 1, "ldpaths", "Load bindings from dir1:dir2:... [default = " BINDING_INSTALL_DIR "]"}, {SO_BINDING, 1, "binding", "Load the binding of path"}, - {SET_WEAK_LDPATH, 1, "weak-ldpaths","Same as --ldpaths but ignore erros"}, + {SET_WEAK_LDPATH, 1, "weak-ldpaths","Same as --ldpaths but ignore errors"}, + {NO_LDPATH, 0, "no-ldpaths", "Discard default ldpaths loading"}, {SET_AUTH_TOKEN, 1, "token", "Initial Secret [default=no-session, --token= for session without authentication]"}, {SET_RNDTOKEN, 0, "random-token","Creates a random token"}, @@ -463,6 +465,11 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config) list_add(&config->weak_ldpaths, argvalstr(optc)); break; + case NO_LDPATH: + noarg(optc); + config->no_ldpaths = 1; + break; + case ADD_CALL: list_add(&config->calls, argvalstr(optc)); break; @@ -612,7 +619,7 @@ static void config_set_default(struct afb_config *config) if (config->rootapi == NULL) config->rootapi = "/api"; - if (config->ldpaths == NULL && config->weak_ldpaths == NULL) + if (config->ldpaths == NULL && config->weak_ldpaths == NULL && !config->no_ldpaths) list_add(&config->ldpaths, BINDING_INSTALL_DIR); // if no config dir create a default path from uploaddir diff --git a/src/afb-config.h b/src/afb-config.h index a81d296e..5abf8054 100644 --- a/src/afb-config.h +++ b/src/afb-config.h @@ -60,6 +60,7 @@ struct afb_config { int tracesvc; int traceevt; int noHttpd; + int no_ldpaths; /* disable default ldpaths */ }; extern struct afb_config *afb_config_parse_arguments(int argc, char **argv); -- 2.16.6