summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-04-15 07:59:50 +0000
committermidipix <writeonce@midipix.org>2021-04-15 09:44:27 +0000
commit688ec9217662849ba5f558b8132648e96567c80c (patch)
tree7dfc4bd618dd92a0e14d9d2b99cb36790c7a5dc3 /src
parentff9a9037501a2277122bd508ba22581955313f34 (diff)
downloadslibtool-688ec9217662849ba5f558b8132648e96567c80c.tar.bz2
slibtool-688ec9217662849ba5f558b8132648e96567c80c.tar.xz
library: replace all uses of getcwd() with slbt_realpath().
Diffstat (limited to 'src')
-rw-r--r--src/helper/slbt_archive_import.c6
-rw-r--r--src/logic/slbt_exec_link.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/helper/slbt_archive_import.c b/src/helper/slbt_archive_import.c
index 071654f..6b861bc 100644
--- a/src/helper/slbt_archive_import.c
+++ b/src/helper/slbt_archive_import.c
@@ -38,7 +38,7 @@ static char * slbt_mri_argument(
if (arg[0] == '/')
target = arg;
else {
- if (!(getcwd(mricwd,sizeof(mricwd))))
+ if (slbt_realpath(fdat,".",O_DIRECTORY,mricwd,sizeof(mricwd)))
return 0;
if ((size_t)snprintf(dstbuf,sizeof(dstbuf),"%s/%s",
@@ -131,6 +131,10 @@ int slbt_archive_import(
dst = slbt_mri_argument(fdcwd,dstarchive,mridst);
src = slbt_mri_argument(fdcwd,srcarchive,mrisrc);
+
+ if (!dst || !src)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
fmt = "OPEN %s\n"
"ADDLIB %s\n"
"SAVE\n"
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 6f73c77..b94ed44 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -1549,7 +1549,7 @@ static int slbt_exec_link_create_library(
}
/* cwd */
- if (!getcwd(cwd,sizeof(cwd)))
+ if (slbt_realpath(fdcwd,".",O_DIRECTORY,cwd,sizeof(cwd)))
return SLBT_SYSTEM_ERROR(dctx,0);
/* .libs/libfoo.so --> -L.libs -lfoo */
@@ -1650,7 +1650,7 @@ static int slbt_exec_link_create_executable(
verinfo = slbt_source_version();
/* cwd, DL_PATH fixup */
- if (!getcwd(cwd,sizeof(cwd))) {
+ if (slbt_realpath(fdcwd,".",O_DIRECTORY,cwd,sizeof(cwd))) {
return SLBT_SYSTEM_ERROR(dctx,0);
} else {
slbt_emit_fdwrap_dl_path_fixup(