Commit 53dc6739 authored by Baptiste Daroussin's avatar Baptiste Daroussin
Browse files

Fix pkg register symlinks

parent 6198436f
......@@ -1235,6 +1235,7 @@ pkg_add_fromdir(struct pkg *pkg, const char *src)
kh_hls_t *hardlinks = NULL;;
const char *path;
char buffer[128];
size_t link_len;
fromfd = open(src, O_DIRECTORY);
if (fromfd == -1) {
......@@ -1316,9 +1317,15 @@ pkg_add_fromdir(struct pkg *pkg, const char *src)
f->time[0] = st.st_atim;
f->time[1] = st.st_mtim;
if (S_ISLNK(st.st_mode)) {
readlinkat(pkg->rootfd, RELATIVE_PATH(f->path), target, sizeof(target));
if ((link_len = readlinkat(fromfd,
RELATIVE_PATH(f->path), target,
sizeof(target))) == -1) {
pkg_emit_error("Impossible to read symlinks "
"'%s': %s", f->path, strerror(errno));
return (EPKG_FATAL);
}
target[link_len] = '\0';
if (create_symlinks(pkg, f, target) == EPKG_FATAL) {
return (EPKG_FATAL);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment