notaz.gp2x.de
/
ginge.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wiz port. Lots of refactoring, some bugfixes
[ginge.git]
/
common
/
cmn.c
diff --git
a/common/cmn.c
b/common/cmn.c
index
9f802ba
..
7886c7c
100644
(file)
--- a/
common/cmn.c
+++ b/
common/cmn.c
@@
-1,3
+1,4
@@
+// vim:shiftwidth=2:expandtab
#ifdef LOADER
#include "../loader/realfuncs.h"
#endif
#ifdef LOADER
#include "../loader/realfuncs.h"
#endif
@@
-12,24
+13,24
@@
int make_local_path(char *buf, size_t size, const char *file)
ssize_t ret;
char *p;
ssize_t ret;
char *p;
- ret = readlink("/proc/self/exe", buf, size - 1);
- if (ret < 0) {
- perror("readlink");
- goto err;
+ p = getenv("GINGE_ROOT");
+ if (p != NULL) {
+ strncpy(buf, p, size);
+ buf[size - 1] = 0;
+ p = buf + strlen(buf);
}
}
- buf[ret] = 0;
-
- p = strrchr(buf, '/');
- if (p == NULL)
- goto err;
- p++;
+ else {
+ ret = readlink("/proc/self/exe", buf, size - 1);
+ if (ret < 0) {
+ perror("readlink");
+ goto err;
+ }
+ buf[ret] = 0;
- if (strstr(p, ".so")) {
- p = getenv("GINGE_ROOT");
+ p = strrchr(buf, '/');
if (p == NULL)
goto err;
if (p == NULL)
goto err;
- strcpy(buf, p);
- p = buf + strlen(buf);
+ p++;
}
snprintf(p, size - (p - buf), "%s", file);
}
snprintf(p, size - (p - buf), "%s", file);