From 3056ff4e8dd7e01aefca2f11c586997efd1a2588 Mon Sep 17 00:00:00 2001 From: midipix Date: Feb 04 2024 03:50:29 +0000 Subject: slbt_exec_install(): enhance logging of file operation errors. --- 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);