From 3056ff4e8dd7e01aefca2f11c586997efd1a2588 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 4 Feb 2024 03:50:29 +0000 Subject: slbt_exec_install(): enhance logging of file operation errors. --- src/logic/slbt_exec_install.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'src/logic/slbt_exec_install.c') 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); -- cgit v1.2.3