From 80be0e3fcf7043490f3c13208f9501ed000c23d5 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 8 Jun 2010 09:06:51 +0200 Subject: Fixing linux portion of the new dll loader. --- src/lua-plugin.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lua-plugin.cc b/src/lua-plugin.cc index fe4b0b5..0069123 100644 --- a/src/lua-plugin.cc +++ b/src/lua-plugin.cc @@ -123,19 +123,19 @@ void LuaLoadPlugin(Handle * h, Lua * L) throw (GeneralException) { // I don't know of any good way of doing this under linux except this one... *shrug* void LuaLoadPlugin(Handle * h, Lua * L) throw (GeneralException) { - char ftemplate[] = "/tmp/luaplugin.so.XXXXXX"); - int h; + char ftemplate[] = "/tmp/luaplugin.so.XXXXXX"; + int hdl; - if ((h = mkstemp(ftemplate)) == -1) - throw GeneralException("Can't create temporary file to load plugin " + h->Getname()); + if ((hdl = mkstemp(ftemplate)) == -1) + throw GeneralException("Can't create temporary file to load plugin " + h->GetName()); Byte * buffer; buffer = (Byte *) malloc(h->GetSize()); h->read(buffer, h->GetSize()); - if (write(h, buffer, h->GetSize()) != h->GetSize()) { + if (write(hdl, buffer, h->GetSize()) != h->GetSize()) { free(buffer); - close(h); + close(hdl); unlink(ftemplate); throw GeneralException("Couldn't write to temporary file."); } @@ -143,9 +143,9 @@ void LuaLoadPlugin(Handle * h, Lua * L) throw (GeneralException) { free(buffer); void * handle = dlopen(ftemplate, RTLD_NOW | RTLD_GLOBAL); unlink(ftemplate); - close(h); + close(hdl); - Base::printm(M_INFO, "Loading library " + fname + "\n"); + Base::printm(M_INFO, "Loading library " + h->GetName() + "\n"); if (!handle) throw("Can't load library " + h->GetName() + " from memory."); -- cgit v1.2.3