Remove a useless open() of the module we're about to load.

This commit is contained in:
Adam Jackson 2006-07-21 22:55:41 -04:00
parent 985611d5cd
commit 114264584c
3 changed files with 3 additions and 16 deletions

View File

@ -129,7 +129,7 @@ DLFindSymbol(const char *name)
} }
void * void *
DLLoadModule(loaderPtr modrec, int fd, int flags) DLLoadModule(loaderPtr modrec, int flags)
{ {
DLModulePtr dlfile; DLModulePtr dlfile;
DLModuleList *l; DLModuleList *l;

View File

@ -26,7 +26,7 @@
#ifndef _DLLOADER_H #ifndef _DLLOADER_H
#define _DLLOADER_H #define _DLLOADER_H
extern void *DLLoadModule(loaderPtr, int, int flags); extern void *DLLoadModule(loaderPtr, int flags);
extern void DLUnloadModule(void *); extern void DLUnloadModule(void *);
extern void *DLFindSymbol(const char *name); extern void *DLFindSymbol(const char *name);

View File

@ -313,7 +313,6 @@ LoaderOpen(const char *module, const char *cname, int handle,
{ {
loaderPtr tmp; loaderPtr tmp;
int new_handle; int new_handle;
int fd;
#if defined(DEBUG) #if defined(DEBUG)
ErrorF("LoaderOpen(%s)\n", module); ErrorF("LoaderOpen(%s)\n", module);
@ -369,16 +368,6 @@ LoaderOpen(const char *module, const char *cname, int handle,
freeHandles[new_handle] = HANDLE_USED; freeHandles[new_handle] = HANDLE_USED;
refCount[new_handle] = 1; refCount[new_handle] = 1;
if ((fd = open(module, O_RDONLY)) < 0) {
xf86Msg(X_ERROR, "Unable to open %s\n", module);
freeHandles[new_handle] = HANDLE_FREE;
if (errmaj)
*errmaj = LDR_NOMODOPEN;
if (errmin)
*errmin = errno;
return -1;
}
tmp = _LoaderListPush(); tmp = _LoaderListPush();
tmp->name = malloc(strlen(module) + 1); tmp->name = malloc(strlen(module) + 1);
strcpy(tmp->name, module); strcpy(tmp->name, module);
@ -387,7 +376,7 @@ LoaderOpen(const char *module, const char *cname, int handle,
tmp->handle = new_handle; tmp->handle = new_handle;
tmp->module = moduleseq++; tmp->module = moduleseq++;
if ((tmp->private = DLLoadModule(tmp, fd, flags)) == NULL) { if ((tmp->private = DLLoadModule(tmp, flags)) == NULL) {
xf86Msg(X_ERROR, "Failed to load %s\n", module); xf86Msg(X_ERROR, "Failed to load %s\n", module);
_LoaderListPop(new_handle); _LoaderListPop(new_handle);
freeHandles[new_handle] = HANDLE_FREE; freeHandles[new_handle] = HANDLE_FREE;
@ -398,8 +387,6 @@ LoaderOpen(const char *module, const char *cname, int handle,
return -1; return -1;
} }
close(fd);
return new_handle; return new_handle;
} }