libfstools: extroot: simplify kmodloader invocation
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 25 Feb 2015 12:44:40 +0000 (13:44 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 25 Feb 2015 12:44:43 +0000 (13:44 +0100)
Now that kmodloader supports LD_LIBRARY_PATH and ignores argv[2] we can
remove the extra argument and save one intermediate pointer.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
libfstools/extroot.c

index 4225d8b08752fa41c211d621227e6a19cb3049ef..73ceae85f5d119f71392f9e70741eb352ae404e6 100644 (file)
@@ -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;
 
@@ -62,8 +61,8 @@ 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)) {
                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);
+               snprintf(kmod_loader, sizeof(kmod_loader),
+                        "/sbin/kmodloader %s/etc/modules-boot.d/", dirname(ldlib_path));
                system(kmod_loader);
        }