Skip to content
Snippets Groups Projects
Commit ffc63ea4 authored by zimoch's avatar zimoch
Browse files

don't use ld in code

parent 43c01a78
No related branches found
No related tags found
No related merge requests found
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
#include <sysSymTbl.h> #include <sysSymTbl.h>
#include <sysLib.h> #include <sysLib.h>
#include <symLib.h> #include <symLib.h>
#include <loadLib.h>
#include <shellLib.h> #include <shellLib.h>
#include <usrLib.h> #include <usrLib.h>
#include <taskLib.h> #include <taskLib.h>
#include <stat.h> #include <stat.h>
#include <stdio.h> #include <stdio.h>
#include <ioLib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <require.h> #include <require.h>
...@@ -66,6 +68,8 @@ int require(char* lib, char* vers) ...@@ -66,6 +68,8 @@ int require(char* lib, char* vers)
SYM_TYPE type; SYM_TYPE type;
struct stat filestat; struct stat filestat;
char version[20]; char version[20];
int fd;
MODULE_ID libhandle = NULL;
if (symFindByName(sysSymTbl, "LIB", (char**)&path, &type) != OK) if (symFindByName(sysSymTbl, "LIB", (char**)&path, &type) != OK)
{ {
...@@ -188,16 +192,16 @@ int require(char* lib, char* vers) ...@@ -188,16 +192,16 @@ int require(char* lib, char* vers)
/* load library */ /* load library */
printf("Loading %s\n", libname); printf("Loading %s\n", libname);
if (ld(0, 0, libname) == NULL) fd = open(libname, O_RDONLY, 0);
if (fd >= 0)
{ {
printf("Loading %s library failed.\n", lib); errno = 0;
printf("Aborting startup stript.\n"); libhandle = loadModule(fd, LOAD_GLOBAL_SYMBOLS);
shellScriptAbort(); close (fd);
return ERROR;
} }
if (errno == S_symLib_SYMBOL_NOT_FOUND) if (libhandle == NULL || errno == S_symLib_SYMBOL_NOT_FOUND)
{ {
printf("Library requires some other functions.\n"); printf("Loading %s library failed: %s\n", lib, strerror(errno));
printf("Aborting startup stript.\n"); printf("Aborting startup stript.\n");
shellScriptAbort(); shellScriptAbort();
return ERROR; return ERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment