Skip to content

Commit 06d3161

Browse files
nabijaczlewelijohannbg
authored andcommitted
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
1 parent e7d6a1e commit 06d3161

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/install/dracut-install.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ static char *convert_abs_rel(const char *from, const char *target)
173173
dirlen = dir_len(target);
174174
target_dir_p = strndup(target, dirlen);
175175
if (!target_dir_p)
176-
return strdup(from);
176+
return strdup(from + strlen(destrootdir));
177177

178178
realpath_p = realpath(target_dir_p, NULL);
179179
if (realpath_p == NULL) {
180180
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
181-
return strdup(from);
181+
return strdup(from + strlen(destrootdir));
182182
}
183183

184184
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one

0 commit comments

Comments
 (0)