From e08e97a6d47497021a81a2b5a803a8f2ab39b00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 28 Apr 2022 18:46:28 +0200 Subject: [PATCH] fix(dracut-install): convert_abs_rel: return valid path on error convert_abs_rel() gets from =/var/tmp/dracut.8dxnpY/initramfs/lib/x86_64-linux-gnu/libuuid.so.1.3.0 target=/var/tmp/dracut.8dxnpY/initramfs/lib/x86_64-linux-gnu/libuuid.so returning from is invalid; skip over the destdir: /lib/x86_64-linux-gnu/libuuid.so.1.3.0 --- src/install/dracut-install.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index 21178e57f1..31ac4f0f4a 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -173,12 +173,12 @@ static char *convert_abs_rel(const char *from, const char *target) dirlen = dir_len(target); target_dir_p = strndup(target, dirlen); if (!target_dir_p) - return strdup(from); + return strdup(from + strlen(destrootdir)); realpath_p = realpath(target_dir_p, NULL); if (realpath_p == NULL) { log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target); - return strdup(from); + return strdup(from + strlen(destrootdir)); } /* dir_len() skips double /'s e.g. //lib64, so we can't skip just one