summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-06-08 09:06:51 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-06-08 09:06:51 +0200
commit80be0e3fcf7043490f3c13208f9501ed000c23d5 (patch)
tree758322aaa8044d661bb05d97c5f7964c27d66775
parenta9b54e9c53a22cfc90de7dc684127adba1cf32ae (diff)
Fixing linux portion of the new dll loader.
-rw-r--r--src/lua-plugin.cc16
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.");