Skip to content

Commit 10ed204

Browse files
dtardonjohannbg
authored andcommitted
fix(install): extend hwcaps library handling to libraries under glibc-hwcaps/
1 parent 591118c commit 10ed204

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/install/dracut-install.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ static int cp(const char *src, const char *dst)
354354
static int library_install(const char *src, const char *lib)
355355
{
356356
_cleanup_free_ char *p = NULL;
357-
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
358-
char *q;
357+
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *pppdir = NULL, *clib = NULL;
358+
char *q, *clibdir;
359359
int r, ret = 0;
360360

361361
p = strdup(lib);
@@ -377,7 +377,8 @@ static int library_install(const char *src, const char *lib)
377377
log_debug("Lib install: '%s'", p);
378378
}
379379

380-
/* Also try to install the same library from one directory above.
380+
/* Also try to install the same library from one directory above
381+
* or from one directory above glibc-hwcaps.
381382
This fixes the case, where only the HWCAP lib would be installed
382383
# ldconfig -p|grep -F libc.so
383384
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
@@ -398,10 +399,18 @@ static int library_install(const char *src, const char *lib)
398399
return ret;
399400

400401
ppdir = strdup(ppdir);
402+
pppdir = dirname(ppdir);
403+
if (!pppdir)
404+
return ret;
405+
406+
pppdir = strdup(pppdir);
407+
if (!pppdir)
408+
return ret;
401409

402410
strcpy(p, lib);
403411

404-
clib = strjoin(ppdir, "/", basename(p), NULL);
412+
clibdir = streq(basename(ppdir), "glibc-hwcaps") ? pppdir : ppdir;
413+
clib = strjoin(clibdir, "/", basename(p), NULL);
405414
if (dracut_install(clib, clib, false, false, true) == 0)
406415
log_debug("Lib install: '%s'", clib);
407416
/* also install lib.so for lib.so.* files */

0 commit comments

Comments
 (0)