From: наб Date: Thu, 28 Apr 2022 16:46:28 +0000 (+0200) Subject: fix(dracut-install): convert_abs_rel: return valid path on error X-Git-Tag: 058~213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d316171cd5e0e86c21006f93776ba9f49087cc;p=thirdparty%2Fdracut.git 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 --- diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index 21178e57f..31ac4f0f4 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