From bb9a1d2a34f3d8d3c528378828e4ce96ba5dbaf6 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Fri, 18 Dec 2020 11:17:14 +0800 Subject: [PATCH] example.c: fix load plugin path Signed-off-by: Jianhui Zhao --- example/example.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/example.c b/example/example.c index 0ce5fca..b3779ec 100644 --- a/example/example.c +++ b/example/example.c @@ -124,6 +124,7 @@ int main(int argc, char **argv) struct ev_loop *loop = EV_DEFAULT; struct ev_signal signal_watcher; struct uh_server *srv = NULL; + char plugin_path[128]; bool verbose = false; bool ssl = false; int port = 8080; @@ -168,7 +169,9 @@ int main(int argc, char **argv) srv->add_path_handler(srv, "/upload", upload_handler); - srv->load_plugin(srv, "test_plugin.so"); + getcwd(plugin_path, sizeof(plugin_path)); + strcat(plugin_path, "/example/test_plugin.so"); + srv->load_plugin(srv, plugin_path); uh_log_info("Listen on: *:%d\n", port);