From: Jo-Philipp Wich <jow@openwrt.org>
Date: Thu, 17 Apr 2014 17:56:31 +0000 (+0200)
Subject: set LD_LIBRARY_PATH when invoking block extroot from temporary overlay
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fe222812cc12d37647fbb8667851eb005ea95331;p=oweals%2Ffstools.git

set LD_LIBRARY_PATH when invoking block extroot from temporary overlay

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
---

diff --git a/libfstools/extroot.c b/libfstools/extroot.c
index a8c1028..9a05c49 100644
--- a/libfstools/extroot.c
+++ b/libfstools/extroot.c
@@ -26,6 +26,7 @@ char const *extroot_prefix = NULL;
 
 int mount_extroot(void)
 {
+	char ldlib_path[32];
 	char block_path[32];
 	char kmod_loader[64];
 	struct stat s;
@@ -34,6 +35,7 @@ int mount_extroot(void)
 	if (!extroot_prefix)
 		return -1;
 
+	sprintf(ldlib_path, "%s/lib", extroot_prefix);
 	sprintf(block_path, "%s/sbin/block", extroot_prefix);
 
 	if (stat(block_path, &s))
@@ -45,6 +47,7 @@ int mount_extroot(void)
 	pid = fork();
 	if (!pid) {
 		mkdir("/tmp/extroot", 0755);
+		setenv("LD_LIBRARY_PATH", ldlib_path, 1);
 		execl(block_path, block_path, "extroot", NULL);
 		exit(-1);
 	} else if (pid > 0) {