X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=libfstools%2Fextroot.c;h=418df9494f7f4ba0a59f4efa3963c34c424d4f39;hb=a5fa5b6144253726dcd7e769197eed787a723f5f;hp=4225d8b08752fa41c211d621227e6a19cb3049ef;hpb=e1119791504bc5cc2302a844232dd469408b769d;p=project%2Ffstools.git diff --git a/libfstools/extroot.c b/libfstools/extroot.c index 4225d8b..418df94 100644 --- a/libfstools/extroot.c +++ b/libfstools/extroot.c @@ -33,8 +33,7 @@ int mount_extroot(void) { char ldlib_path[32]; char block_path[32]; - char kmod_loader[128]; - char *kmod_prefix; + char kmod_loader[64]; struct stat s; pid_t pid; @@ -61,10 +60,12 @@ int mount_extroot(void) /* set LD_LIBRARY_PATH env var and load kmods from overlay if we found a lib directory there */ if (!stat(ldlib_path, &s) && S_ISDIR(s.st_mode)) { + ULOG_INFO("loading kmods from internal overlay\n"); setenv("LD_LIBRARY_PATH", ldlib_path, 1); - kmod_prefix = dirname(ldlib_path); - sprintf(kmod_loader, "/sbin/kmodloader %s/etc/modules-boot.d/ %s", kmod_prefix, kmod_prefix); - system(kmod_loader); + snprintf(kmod_loader, sizeof(kmod_loader), + "/sbin/kmodloader %s/etc/modules-boot.d/", dirname(ldlib_path)); + if (system(kmod_loader)) + ULOG_ERR("failed to launch kmodloader from internal overlay\n"); } pid = fork(); @@ -87,10 +88,10 @@ int mount_extroot(void) mkdir("/tmp/extroot/mnt/rom", 0755); if (mount_move("/tmp/extroot", "", "/mnt")) { - fprintf(stderr, "moving pivotroot failed - continue normal boot\n"); + ULOG_ERR("moving pivotroot failed - continue normal boot\n"); umount("/tmp/extroot/mnt"); } else if (pivot("/mnt", "/rom")) { - fprintf(stderr, "switching to pivotroot failed - continue normal boot\n"); + ULOG_ERR("switching to pivotroot failed - continue normal boot\n"); umount("/mnt"); } else { umount("/tmp/overlay"); @@ -101,10 +102,10 @@ int mount_extroot(void) } } else if (find_mount("/tmp/extroot/overlay")) { if (mount_move("/tmp/extroot", "", "/overlay")) { - fprintf(stderr, "moving extroot failed - continue normal boot\n"); + ULOG_ERR("moving extroot failed - continue normal boot\n"); umount("/tmp/extroot/overlay"); } else if (fopivot("/overlay", "/rom")) { - fprintf(stderr, "switching to extroot failed - continue normal boot\n"); + ULOG_ERR("switching to extroot failed - continue normal boot\n"); umount("/overlay"); } else { umount("/tmp/overlay");