summaryrefslogtreecommitdiff
path: root/src/core/lt_path.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lt_path.c')
-rw-r--r--src/core/lt_path.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c
index c945b7f..01de5b6 100644
--- a/src/core/lt_path.c
+++ b/src/core/lt_path.c
@@ -59,14 +59,14 @@ static int lt_dlsetsearchpath_locked(const char * path)
off_t elements;
if (path[0] != '/')
- return lt_setstatus(1,SLTDL_PATH_INVALID_FIRST_CHAR);
+ return lt_setstatus(1,SLTDL_ERR_PATH_INVALID_FIRST_CHAR);
elements = 1;
for (ch=&path[1]; *ch; ch++) {
if (*ch == ':') {
if (ch[1] != '/')
- return lt_setstatus(1,SLTDL_PATH_INVALID_FIRST_CHAR);
+ return lt_setstatus(1,SLTDL_ERR_PATH_INVALID_FIRST_CHAR);
elements++;
}
@@ -84,7 +84,7 @@ static int lt_dlsetsearchpath_locked(const char * path)
lt_plocs ^= 0x3f;
if (!(lt_pathv = calloc(lt_plocs,sizeof(char *))))
- return lt_setstatus(1,SLTDL_SYSTEM_ERROR);
+ return lt_setstatus(1,SLTDL_ERR_SYSTEM_ERROR);
}
if ((ch - path) > lt_plen) {
@@ -100,7 +100,7 @@ static int lt_dlsetsearchpath_locked(const char * path)
lt_plen |= 0x7ff;
lt_plen ^= 0x7ff;
if (!(lt_upath = calloc(2*lt_plen,1)))
- return lt_setstatus(1,SLTDL_SYSTEM_ERROR);
+ return lt_setstatus(1,SLTDL_ERR_SYSTEM_ERROR);
lt_vpath = &lt_upath[lt_plen];
}
@@ -127,7 +127,7 @@ static int lt_dlsetsearchpath_locked(const char * path)
lt_vmark = pathv;
- return lt_setstatus(0,SLTDL_OK);
+ return lt_setstatus(0,SLTDL_ERR_OK);
}
int lt_dlsetsearchpath(const char * path)
@@ -147,11 +147,11 @@ static int lt_dladdsearchdir_locked(const char * path)
off_t plen;
if (path[0] != '/')
- return lt_setstatus(1,SLTDL_PATH_INVALID_FIRST_CHAR);
+ return lt_setstatus(1,SLTDL_ERR_PATH_INVALID_FIRST_CHAR);
for (ch=path; *ch; ch++)
if (*ch == ':')
- return lt_setstatus(1,SLTDL_PATH_INVALID_SEPARATTOR_CHAR);
+ return lt_setstatus(1,SLTDL_ERR_PATH_INVALID_SEPARATTOR_CHAR);
alen = strlen(path);
plen = strlen(lt_upath);
@@ -168,12 +168,12 @@ static int lt_dladdsearchdir_locked(const char * path)
*lt_vmark++ = &lt_vpath[plen];
- return lt_setstatus(0,SLTDL_OK);
+ return lt_setstatus(0,SLTDL_ERR_OK);
}
/* (allocation needed) */
if (!(buf = malloc(plen + 1 + alen + 1)))
- return lt_setstatus(1,SLTDL_SYSTEM_ERROR);
+ return lt_setstatus(1,SLTDL_ERR_SYSTEM_ERROR);
sprintf(buf,"%s:%s",lt_upath,path);
@@ -210,20 +210,20 @@ int lt_dlinsertsearchdir(const char * mark, const char * path)
lt_slock();
if (path[0] != '/')
- return lt_sunlock(1,SLTDL_PATH_INVALID_FIRST_CHAR);
+ return lt_sunlock(1,SLTDL_ERR_PATH_INVALID_FIRST_CHAR);
for (ch=path; *ch; ch++)
if (*ch == ':')
- return lt_sunlock(1,SLTDL_PATH_INVALID_SEPARATTOR_CHAR);
+ return lt_sunlock(1,SLTDL_ERR_PATH_INVALID_SEPARATTOR_CHAR);
alen = strlen(path);
plen = strlen(lt_upath);
if ((mark < lt_upath) || (mark >= &lt_upath[plen]))
- return lt_sunlock(1,SLTDL_PATH_INVALID_MARK);
+ return lt_sunlock(1,SLTDL_ERR_PATH_INVALID_MARK);
if ((mark > lt_upath) && (mark[-1] != ':'))
- return lt_sunlock(1,SLTDL_PATH_INVALID_MARK);
+ return lt_sunlock(1,SLTDL_ERR_PATH_INVALID_MARK);
mark = &lt_vpath[mark - lt_upath];
@@ -248,14 +248,14 @@ int lt_dlinsertsearchdir(const char * mark, const char * path)
memcpy(&lt_upath[offset],path,alen);
lt_upath[offset+alen] = ':';
lt_vmark++;
- return lt_sunlock(0,SLTDL_OK);
+ return lt_sunlock(0,SLTDL_ERR_OK);
}
}
}
/* (allocation needed) */
if (!(buf = malloc(plen + 1 + alen + 1)))
- return lt_sunlock(1,SLTDL_SYSTEM_ERROR);
+ return lt_sunlock(1,SLTDL_ERR_SYSTEM_ERROR);
for (dst=buf, pathv=lt_pathv; *pathv; pathv++) {
if (*pathv == mark)
@@ -289,7 +289,7 @@ static int lt_dlpathopen_locked(
char path[1024];
if ((mlen = strlen(module)) >= sizeof(path))
- return lt_setstatus(-1,SLTDL_PATH_INVALID_LEN);
+ return lt_setstatus(-1,SLTDL_ERR_PATH_INVALID_LEN);
memcpy(path,module,mlen);
@@ -298,14 +298,14 @@ static int lt_dlpathopen_locked(
if (mpath) {
if (!(*mpath = realpath(path,0))) {
close(fdmod);
- return lt_setstatus(-1,SLTDL_SYSTEM_ERROR);
+ return lt_setstatus(-1,SLTDL_ERR_SYSTEM_ERROR);
}
}
- return lt_setstatus(fdmod,SLTDL_OK);
+ return lt_setstatus(fdmod,SLTDL_ERR_OK);
}
- return lt_setstatus(-1,SLTDL_PATH_NO_ENTRY);
+ return lt_setstatus(-1,SLTDL_ERR_PATH_NO_ENTRY);
}
for (ppath=lt_pathv; ppath && *ppath; ppath++) {
@@ -315,7 +315,7 @@ static int lt_dlpathopen_locked(
for (pext=extv; *pext; pext++) {
if (mlen + (elen = strlen(*pext)) >= (sizeof(path))) {
close(fdat);
- return lt_setstatus(-1,SLTDL_PATH_INVALID_LEN);
+ return lt_setstatus(-1,SLTDL_ERR_PATH_INVALID_LEN);
}
memcpy(&path[mlen],*pext,elen);
@@ -331,14 +331,14 @@ static int lt_dlpathopen_locked(
if (!(*mpath = malloc(plen))) {
close(fdat);
close(fdmod);
- return lt_setstatus(-1,SLTDL_SYSTEM_ERROR);
+ return lt_setstatus(-1,SLTDL_ERR_SYSTEM_ERROR);
}
sprintf(*mpath,"%s/%s",*ppath,path);
}
close(fdat);
- return lt_setstatus(fdmod,SLTDL_OK);
+ return lt_setstatus(fdmod,SLTDL_ERR_OK);
}
}
@@ -346,7 +346,7 @@ static int lt_dlpathopen_locked(
}
}
- return lt_setstatus(-1,SLTDL_PATH_NO_ENTRY);
+ return lt_setstatus(-1,SLTDL_ERR_PATH_NO_ENTRY);
}
int lt_dlpathopen(const char * module, const char ** extv)
@@ -378,7 +378,7 @@ static struct lt_modctx * lt_dlopen_locked(
if (lt_modv_next == lt_modv_cap) {
if (!(modctx_buf = calloc(64,sizeof(*modctx)))) {
free(mpath);
- lt_setstatus(0,SLTDL_SYSTEM_ERROR);
+ lt_setstatus(0,SLTDL_ERR_SYSTEM_ERROR);
return 0;
}
@@ -389,7 +389,7 @@ static struct lt_modctx * lt_dlopen_locked(
/* dlopen */
if (!(maddr = dlopen(mpath,mode))) {
free(mpath);
- lt_setstatus(0,SLTDL_DLFCN_ERROR);
+ lt_setstatus(0,SLTDL_ERR_DLFCN_ERROR);
return 0;
}
@@ -433,7 +433,7 @@ struct lt_modctx * lt_dlopen(const char * module)
lt_slock();
if ((slen = strlen(module)) >= PATH_MAX) {
- lt_setstatus(0,SLTDL_SYSTEM_ERROR);
+ lt_setstatus(0,SLTDL_ERR_SYSTEM_ERROR);
lt_sunlock(0,lt_status);
return 0;
}
@@ -484,14 +484,14 @@ int lt_dlclose(struct lt_modctx * modctx)
if (pmod == modctx) {
if (pmod->mrefs) {
pmod->mrefs--;
- return lt_sunlock(0,SLTDL_OK);
+ return lt_sunlock(0,SLTDL_ERR_OK);
}
- return lt_sunlock(-1,SLTDL_MODULE_REF_COUNT);
+ return lt_sunlock(-1,SLTDL_ERR_MODULE_REF_COUNT);
}
}
- return lt_sunlock(-1,SLTDL_MODULE_PTR_INVALID);
+ return lt_sunlock(-1,SLTDL_ERR_MODULE_PTR_INVALID);
}
static int lt_dlforeachfile_one(