summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-05-06 22:25:06 +0000
committermidipix <writeonce@midipix.org>2021-05-06 23:59:45 +0000
commitcccab50eb9c04b8729245788f6e7cfb20e600e40 (patch)
tree27ee6c075a6ed4e193acd97dc6da29a5b7b88363
parentc7981ca306e4dfa2d8a5524b3b2063be8a7a6584 (diff)
downloadslibtool-cccab50eb9c04b8729245788f6e7cfb20e600e40.tar.bz2
slibtool-cccab50eb9c04b8729245788f6e7cfb20e600e40.tar.xz
install mode: libfoo.la and ibfoo.so.def.host: properly handle -release.
-rw-r--r--src/logic/slbt_exec_install.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c
index 3f04e66..82c7983 100644
--- a/src/logic/slbt_exec_install.c
+++ b/src/logic/slbt_exec_install.c
@@ -345,6 +345,7 @@ static int slbt_exec_install_entry(
bool frelease;
bool farchive;
size_t slen;
+ size_t dlen;
struct stat st;
/* executable wrapper? */
@@ -436,12 +437,34 @@ static int slbt_exec_install_entry(
slen = sizeof(slnkname);
slen -= (dot - slnkname);
- if ((size_t)snprintf(dot,slen,"%s.def.host",dsosuffix) >= slen)
- return SLBT_BUFFER_ERROR(dctx);
+ /* libfoo.a --> libfoo.so.release */
+ sprintf(dot,"%s.release",dsosuffix);
+ frelease = fstatat(fdcwd,slnkname,&st,0) ? false : true;
/* libfoo.so.def.{flavor} */
- if (slbt_readlinkat(fdcwd,slnkname,hosttag,sizeof(hosttag)))
- return SLBT_SYSTEM_ERROR(dctx,slnkname);
+ if (frelease) {
+ strcpy(dlnkname,slnkname);
+ slash = strrchr(dlnkname,'/');
+
+ dlen = sizeof(dlnkname);
+ dlen -= (++slash - dlnkname);
+ dlen -= 9;
+
+ if (slbt_readlinkat(fdcwd,slnkname,slash,dlen))
+ return SLBT_SYSTEM_ERROR(dctx,slnkname);
+
+ slash += strlen(slash);
+ strcpy(slash,".def.host");
+
+ if (slbt_readlinkat(fdcwd,dlnkname,hosttag,sizeof(hosttag)))
+ return SLBT_SYSTEM_ERROR(dctx,slnkname);
+ } else {
+ if ((size_t)snprintf(dot,slen,"%s.def.host",dsosuffix) >= slen)
+ return SLBT_BUFFER_ERROR(dctx);
+
+ if (slbt_readlinkat(fdcwd,frelease ? dlnkname : slnkname,hosttag,sizeof(hosttag)))
+ return SLBT_SYSTEM_ERROR(dctx,slnkname);
+ }
/* host/flabor */
if (!(host = strrchr(hosttag,'.')))
@@ -453,10 +476,6 @@ static int slbt_exec_install_entry(
if (slbt_set_alternate_host(dctx,host,host))
return SLBT_NESTED_ERROR(dctx);
- /* libfoo.a --> libfoo.so.release */
- sprintf(dot,"%s.release",dsosuffix);
- frelease = fstatat(fdcwd,slnkname,&st,0) ? false : true;
-
/* libfoo.a --> libfoo.so */
strcpy(dot,dsosuffix);