From 1c44cd71a87967c5d8094a3d37ab2598dbd1ef12 Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Fri, 26 Jul 2024 20:53:59 +0000 Subject: [PATCH] fix(dracut-install): handle correctly sysrootdir with trailing '/' Signed-off-by: Ondrej Kubik --- src/install/dracut-install.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index f38865a19..7df3748e4 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -1162,6 +1162,9 @@ static int parse_argv(int argc, char *argv[]) case 'r': sysrootdir = optarg; sysrootdirlen = strlen(sysrootdir); + /* ignore trailing '/' */ + if (sysrootdir[sysrootdirlen-1] == '/') + sysrootdirlen--; break; case 'p': if (regcomp(&mod_filter_path, optarg, REG_NOSUB | REG_EXTENDED) != 0) {