summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-04 03:50:29 +0000
committermidipix <writeonce@midipix.org>2024-02-04 03:50:29 +0000
commit3056ff4e8dd7e01aefca2f11c586997efd1a2588 (patch)
treeb5e8ffc4187ea84a91790817a769e938f4571827
parent5c429555a5cb83026f39fbfd8aeb666b58b283b5 (diff)
downloadslibtool-3056ff4e8dd7e01aefca2f11c586997efd1a2588.tar.bz2
slibtool-3056ff4e8dd7e01aefca2f11c586997efd1a2588.tar.xz
slbt_exec_install(): enhance logging of file operation errors.
-rw-r--r--include/slibtool/slibtool.h1
-rw-r--r--src/logic/slbt_exec_install.c39
2 files changed, 34 insertions, 6 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 21b7234..d30c2dc 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -89,6 +89,7 @@ enum slbt_custom_error {
SLBT_ERR_FLEE_ERROR,
SLBT_ERR_COMPILE_ERROR,
SLBT_ERR_LINK_ERROR,
+ SLBT_ERR_INSTALL_ERROR,
SLBT_ERR_AR_ERROR,
SLBT_ERR_MDSO_ERROR,
SLBT_ERR_DLLTOOL_ERROR,
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c
index d643cae..0f4f38e 100644
--- a/src/logic/slbt_exec_install.c
+++ b/src/logic/slbt_exec_install.c
@@ -324,7 +324,6 @@ static int slbt_exec_install_entry(
char ** src,
char ** dst)
{
- int ret;
int fdcwd;
const char * base;
char * dot;
@@ -399,8 +398,16 @@ static int slbt_exec_install_entry(
if (slbt_output_install(dctx,ectx))
return SLBT_NESTED_ERROR(dctx);
- return (((ret = slbt_spawn(ectx,true)) < 0) || ectx->exitcode)
- ? SLBT_SPAWN_ERROR(dctx) : 0;
+ if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) {
+ return SLBT_SPAWN_ERROR(dctx);
+
+ } else if (ectx->exitcode) {
+ return SLBT_CUSTOM_ERROR(
+ dctx,
+ SLBT_ERR_INSTALL_ERROR);
+ }
+
+ return 0;
}
/* -shrext, dsosuffix */
@@ -580,9 +587,15 @@ static int slbt_exec_install_entry(
if (slbt_output_install(dctx,ectx))
return SLBT_NESTED_ERROR(dctx);
- if (((ret = slbt_spawn(ectx,true)) < 0) || ectx->exitcode)
+ if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) {
return SLBT_SPAWN_ERROR(dctx);
+ } else if (ectx->exitcode) {
+ return SLBT_CUSTOM_ERROR(
+ dctx,
+ SLBT_ERR_INSTALL_ERROR);
+ }
+
return 0;
}
@@ -604,9 +617,15 @@ static int slbt_exec_install_entry(
if (slbt_output_install(dctx,ectx))
return SLBT_NESTED_ERROR(dctx);
- if (((ret = slbt_spawn(ectx,true)) < 0) || ectx->exitcode)
+ if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) {
return SLBT_SPAWN_ERROR(dctx);
+ } else if (ectx->exitcode) {
+ return SLBT_CUSTOM_ERROR(
+ dctx,
+ SLBT_ERR_INSTALL_ERROR);
+ }
+
/* destination symlink: dstdir/libfoo.so */
if ((size_t)snprintf(dlnkname,sizeof(dlnkname),"%s/%s",
dstdir,base) >= sizeof(dlnkname))
@@ -883,10 +902,18 @@ int slbt_exec_install(
if (slbt_output_install(dctx,ectx))
return SLBT_NESTED_ERROR(dctx);
- if (((ret = slbt_spawn(ectx,true)) < 0) || ectx->exitcode)
+ if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) {
return slbt_exec_install_fail(
actx,meta,
SLBT_SPAWN_ERROR(dctx));
+
+ } else if (ectx->exitcode) {
+ return slbt_exec_install_fail(
+ actx,meta,
+ SLBT_CUSTOM_ERROR(
+ dctx,
+ SLBT_ERR_INSTALL_ERROR));
+ }
}
argv_free(meta);