diff options
Diffstat (limited to 'src/lua-plugin.cc')
-rw-r--r-- | src/lua-plugin.cc | 16 |
1 files changed, 8 insertions, 8 deletions
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."); |