]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(install): sane default --kerneldir
authorMarcos Mello <marcosfrm@gmail.com>
Thu, 20 May 2021 18:41:26 +0000 (15:41 -0300)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 20 May 2021 23:56:40 +0000 (23:56 +0000)
If --kerneldir is not specified, use /lib/modules/$(uname -r).

Fixes #1505

src/install/dracut-install.c

index 9f044ae07c371f4331c0e6b24da94c85fffd1ab5..3fd70fc88b6d1b8ea39139b9d22267da8a02fe14 100644 (file)
@@ -1167,7 +1167,10 @@ static int parse_argv(int argc, char *argv[])
         if (!kerneldir) {
                 struct utsname buf;
                 uname(&buf);
-                kerneldir = strdup(buf.version);
+                if (asprintf(&kerneldir, "%s%s", "/lib/modules/", buf.release) < 0) {
+                        log_error("Out of memory!");
+                        exit(EXIT_FAILURE);
+                }
         }
 
         if (arg_modalias) {