summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-09-13 20:12:51 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:15 -0600
commit41d5d2834b61b1cf23b8cc4ec86348c57ace34fe (patch)
treeb2d6cc60222f2cd29bf538692e7f72cf4b84f5a4
parentaba23c26fabcc7961a55d6526bb28c92fb9c4ecd (diff)
add detection for unrecognized plugin commands
-rw-r--r--wrapper/Makefile.in2
-rw-r--r--wrapper/plugin-find.h16
-rw-r--r--wrapper/runcom.c3
3 files changed, 15 insertions, 6 deletions
diff --git a/wrapper/Makefile.in b/wrapper/Makefile.in
index 594b0c0..ed667b4 100644
--- a/wrapper/Makefile.in
+++ b/wrapper/Makefile.in
@@ -44,7 +44,7 @@ INSTALL_DATA ?= $(INSTALL) -m 644
TOUCH ?= touch # This file doesn't use touch
#export RVS SHELL RM CP SED INSTALL MKDIR INSTALL_PROGRAM INSTALL_DATA TOUCH
-CFLAGS = -DLIBEXECDIR=\"$(libexecdir)\" -DPLUGIN_CONF=\"plugin.conf\"
+CFLAGS = -DLIBEXECDIR=\"$(libexecdir)/$(rvs)\" -DPLUGIN_CONF=\"plugin.conf\"
# phony targets ####################################################
all : rvs runcom
diff --git a/wrapper/plugin-find.h b/wrapper/plugin-find.h
index f2d102f..1a5096b 100644
--- a/wrapper/plugin-find.h
+++ b/wrapper/plugin-find.h
@@ -87,11 +87,17 @@ plugin_find_commands(struct plugin *plugin, char *name)
if (plugin==NULL)
return NULL;
else {
- struct plugin_command_list *command;
- command=xmalloc( sizeof *command );
- command->command=plugin_find_command(plugin,name);
- command->next=plugin_find_commands(plugin->next,name);
- return command;
+ struct plugin_command *command;
+ command=plugin_find_command(plugin,name);
+ struct plugin_command_list *node;
+ if (command==NULL)
+ node=plugin_find_commands(plugin->next,name);
+ else {
+ node=xmalloc( sizeof *node );
+ node->command=command;
+ node->next=plugin_find_commands(plugin->next,name);
+ }
+ return node;
}
}
diff --git a/wrapper/runcom.c b/wrapper/runcom.c
index dd843dc..0e8dad8 100644
--- a/wrapper/runcom.c
+++ b/wrapper/runcom.c
@@ -37,6 +37,9 @@ main ( int argc, char *argv[] )
if (argc > 1) {
struct plugin_command_list *list;
list=plugin_find_commands(plugins,argv[1]);
+ if (list==NULL)
+ error(EXIT_FAILURE,0,"unrecognized command `%s'",
+ argv[1]);
struct plugin_command *root;
root=plugin_depend_list(list,plugins);
plugin_free_list(list);