summaryrefslogtreecommitdiff
path: root/rhnop-server/nopsyncd.c
diff options
context:
space:
mode:
Diffstat (limited to 'rhnop-server/nopsyncd.c')
-rw-r--r--rhnop-server/nopsyncd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/rhnop-server/nopsyncd.c b/rhnop-server/nopsyncd.c
index 63bef7f..acb1eb1 100644
--- a/rhnop-server/nopsyncd.c
+++ b/rhnop-server/nopsyncd.c
@@ -30,8 +30,11 @@
#include <lauxlib.h>
#include "l_pipe.h"
+#include "config.h"
#define LUA_MAIN_LOOP_FUNC "main_loop"
+#define QLISTENER LIBDIR"/qlistener.lua"
+#define TCPSERVER LIBDIR"/tcpserver.lua"
static const luaL_Reg nopsyncd_lualibs[] = {
{"", luaopen_base},
@@ -66,6 +69,9 @@ int init_main_loop(lua_State *L, const char* filename)
return -1;
}
+ lua_pushstring(L, LIBDIR);
+ lua_setglobal(L, "rhnoplibdir");
+
ret = lua_pcall(L, 0, 0, 0);
if(ret) {
const char* err_str = luaL_checkstring(L, -1);
@@ -143,14 +149,14 @@ int main(int argc, char* argv[])
return 1;
}
- ret = pthread_create(&qlistener, NULL, main_loop, "qlistener.lua");
+ ret = pthread_create(&qlistener, NULL, main_loop, QLISTENER);
if(ret) {
fprintf(stderr, "Error creating qlistener thread (code: %d)\n", ret);
return 1;
}
pthread_detach(qlistener); /* can't kill this thread so don't join to it */
- ret = pthread_create(&tcpserver, NULL, main_loop, "tcpserver.lua");
+ ret = pthread_create(&tcpserver, NULL, main_loop, TCPSERVER);
if(ret) {
fprintf(stderr, "Error creating qlistener thread (code: %d)\n", ret);
return 1;