summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-27 20:33:46 +0000
committermidipix <writeonce@midipix.org>2024-03-27 20:33:46 +0000
commit54044cd745c5a0aa02cefe2b3946e4090959aa4d (patch)
tree072554d7706c09644f96a14c8b9a1b1479028c1c /src
parentcbdd0975c4492bb05882973d8e27fc7b1b212fd7 (diff)
downloadslibtool-54044cd745c5a0aa02cefe2b3946e4090959aa4d.tar.bz2
slibtool-54044cd745c5a0aa02cefe2b3946e4090959aa4d.tar.xz
slibtoolize mode: install slibtool.m4 only with a specified m4 macro dir.
Diffstat (limited to 'src')
-rw-r--r--src/logic/slbt_exec_stoolie.c12
-rw-r--r--src/stoolie/slbt_stoolie_ctx.c14
2 files changed, 14 insertions, 12 deletions
diff --git a/src/logic/slbt_exec_stoolie.c b/src/logic/slbt_exec_stoolie.c
index c29840b..698faaa 100644
--- a/src/logic/slbt_exec_stoolie.c
+++ b/src/logic/slbt_exec_stoolie.c
@@ -108,16 +108,20 @@ static int slbt_exec_stoolie_perform_actions(
/* --force? */
if (dctx->cctx->drvflags & SLBT_DRIVER_STOOLIE_FORCE) {
- if (slbt_exec_stoolie_remove_file(dctx,ictx->fdm4,"slibtool.m4") < 0)
- return SLBT_NESTED_ERROR(dctx);
+ if (ictx->fdm4 >= 0)
+ if (slbt_exec_stoolie_remove_file(dctx,ictx->fdm4,"slibtool.m4") < 0)
+ return SLBT_NESTED_ERROR(dctx);
if (slbt_exec_stoolie_remove_file(dctx,ictx->fdaux,"ltmain.sh") < 0)
return SLBT_NESTED_ERROR(dctx);
- fslibm4 = true;
+ fslibm4 = (ictx->fdm4 >= 0);
fltmain = true;
} else {
- if (fstatat(ictx->fdm4,"slibtool.m4",&st,AT_SYMLINK_NOFOLLOW) == 0) {
+ if (ictx->fdm4 < 0) {
+ fslibm4 = false;
+
+ } else if (fstatat(ictx->fdm4,"slibtool.m4",&st,AT_SYMLINK_NOFOLLOW) == 0) {
fslibm4 = false;
} else if (errno == ENOENT) {
diff --git a/src/stoolie/slbt_stoolie_ctx.c b/src/stoolie/slbt_stoolie_ctx.c
index ec87821..b74edd3 100644
--- a/src/stoolie/slbt_stoolie_ctx.c
+++ b/src/stoolie/slbt_stoolie_ctx.c
@@ -263,15 +263,13 @@ int slbt_st_get_stoolie_ctx(
SLBT_SYSTEM_ERROR(dctx,dpath));
/* m4 directory */
- if (!(dpath = ctx->m4buf))
- dpath = slbt_this_dir;
-
- if ((ctx->fdm4 = openat(fdtgt,dpath,O_DIRECTORY,0)) < 0)
- if (errno == ENOENT)
- if (!mkdirat(fdtgt,dpath,0755))
- ctx->fdm4 = openat(fdtgt,dpath,O_DIRECTORY,0);
+ if ((dpath = ctx->m4buf))
+ if ((ctx->fdm4 = openat(fdtgt,dpath,O_DIRECTORY,0)) < 0)
+ if (errno == ENOENT)
+ if (!mkdirat(fdtgt,dpath,0755))
+ ctx->fdm4 = openat(fdtgt,dpath,O_DIRECTORY,0);
- if (ctx->fdm4 < 0)
+ if (dpath && (ctx->fdm4 < 0))
return slbt_st_free_stoolie_ctx_impl(
ctx,(-1),
SLBT_SYSTEM_ERROR(dctx,dpath));