Skip to content

Commit c1ab361

Browse files
marcosfrmjohannbg
authored andcommitted
fix(install): sane default --kerneldir
If --kerneldir is not specified, use /lib/modules/$(uname -r). Fixes #1505
1 parent 9355cb8 commit c1ab361

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/install/dracut-install.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,10 @@ static int parse_argv(int argc, char *argv[])
11671167
if (!kerneldir) {
11681168
struct utsname buf;
11691169
uname(&buf);
1170-
kerneldir = strdup(buf.version);
1170+
if (asprintf(&kerneldir, "%s%s", "/lib/modules/", buf.release) < 0) {
1171+
log_error("Out of memory!");
1172+
exit(EXIT_FAILURE);
1173+
}
11711174
}
11721175

11731176
if (arg_modalias) {

0 commit comments

Comments
 (0)