minor fixes

This commit is contained in:
Thomas Pöchtrager 2015-07-19 23:19:31 +02:00
parent 29a5fee522
commit 39b6994d97
3 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,5 @@
diff --git cctools/ld64/src/3rd/helper.c cctools/ld64/src/3rd/helper.c diff --git cctools/ld64/src/3rd/helper.c cctools/ld64/src/3rd/helper.c
index ef33219..6983e52 100644 index ef33219..540e009 100644
--- cctools/ld64/src/3rd/helper.c --- cctools/ld64/src/3rd/helper.c
+++ cctools/ld64/src/3rd/helper.c +++ cctools/ld64/src/3rd/helper.c
@@ -17,11 +17,17 @@ const char ldVersionString[] = "134.9\n"; @@ -17,11 +17,17 @@ const char ldVersionString[] = "134.9\n";
@ -70,7 +70,7 @@ index ef33219..6983e52 100644
+ if (*comm == '/' || *comm == '.') { + if (*comm == '/' || *comm == '.') {
+ char *rpath; + char *rpath;
+ if ((rpath = realpath(comm, NULL))) { + if ((rpath = realpath(comm, NULL))) {
+ snprintf(epath, *size, "%s", rpath); + strlcpy(epath, rpath, *size);
+ free(rpath); + free(rpath);
+ ok = 1; + ok = 1;
+ } + }
@ -112,7 +112,7 @@ index ef33219..6983e52 100644
} }
else else
diff --git cctools/libstuff/emulated.c cctools/libstuff/emulated.c diff --git cctools/libstuff/emulated.c cctools/libstuff/emulated.c
index 1aa355c..b8c52e4 100644 index 1aa355c..633c9dc 100644
--- cctools/libstuff/emulated.c --- cctools/libstuff/emulated.c
+++ cctools/libstuff/emulated.c +++ cctools/libstuff/emulated.c
@@ -14,46 +14,88 @@ @@ -14,46 +14,88 @@
@ -185,7 +185,7 @@ index 1aa355c..b8c52e4 100644
+ if (*comm == '/' || *comm == '.') { + if (*comm == '/' || *comm == '.') {
+ char *rpath; + char *rpath;
+ if ((rpath = realpath(comm, NULL))) { + if ((rpath = realpath(comm, NULL))) {
+ snprintf(epath, *size, "%s", rpath); + strlcpy(epath, rpath, *size);
+ free(rpath); + free(rpath);
+ ok = 1; + ok = 1;
+ } + }
@ -236,7 +236,7 @@ index 1aa355c..b8c52e4 100644
#endif #endif
} }
diff --git usage_examples/ios_toolchain/wrapper.c usage_examples/ios_toolchain/wrapper.c diff --git usage_examples/ios_toolchain/wrapper.c usage_examples/ios_toolchain/wrapper.c
index ed536b2..438032f 100644 index ed536b2..2ebd188 100644
--- usage_examples/ios_toolchain/wrapper.c --- usage_examples/ios_toolchain/wrapper.c
+++ usage_examples/ios_toolchain/wrapper.c +++ usage_examples/ios_toolchain/wrapper.c
@@ -19,30 +19,79 @@ @@ -19,30 +19,79 @@
@ -293,7 +293,7 @@ index ed536b2..438032f 100644
+ if (*comm == '/' || *comm == '.') { + if (*comm == '/' || *comm == '.') {
+ char *rpath; + char *rpath;
+ if ((rpath = realpath(comm, NULL))) { + if ((rpath = realpath(comm, NULL))) {
+ snprintf(epath, buflen, "%s", rpath); + strlcpy(epath, rpath, buflen);
+ free(rpath); + free(rpath);
+ ok = 1; + ok = 1;
+ } + }

View File

@ -9,10 +9,10 @@ prog="cpucount"
pushd "${0%/*}" >/dev/null 2>&1 pushd "${0%/*}" >/dev/null 2>&1
case "$(uname -s)" in case "$(uname -s)" in
*NT*) *NT* | CYGWIN*)
prog="${prog}.exe" ;; prog="${prog}.exe" ;;
esac esac
test ! -f $prog && cc cpucount.c -o cpucount &>/dev/null [ ! -f $prog ] && cc cpucount.c -o cpucount &>/dev/null
eval "./${prog}" eval "./${prog}"

View File

@ -114,8 +114,12 @@ char *getExecutablePath(char *buf, size_t len) {
abort(); abort();
comm = argv[0]; comm = argv[0];
if (*comm == '/' || *comm == '.') { if (*comm == '/' || *comm == '.') {
if (realpath(comm, buf)) char *rpath;
if ((rpath = realpath(comm, NULL))) {
strlcpy(buf, rpath, len);
free(rpath);
ok = 1; ok = 1;
}
} else { } else {
char *sp; char *sp;
char *xpath = strdup(getenv("PATH")); char *xpath = strdup(getenv("PATH"));