Skip to content

Commit

Permalink
fix(dracut-install): convert_abs_rel: return valid path on error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nabijaczleweli authored and johannbg committed Jun 24, 2022
1 parent e7d6a1e commit 06d3161
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/install/dracut-install.c
Expand Up @@ -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
Expand Down

0 comments on commit 06d3161

Please sign in to comment.