Skip to content

Commit

Permalink
Fix checksum on symlinks (freebsd#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
bapt committed Jun 22, 2016
1 parent 830eab2 commit 1b23a90
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libpkg/pkg_checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,17 @@ pkg_checksum_symlink_readlink(const char *linkbuf, int linklen, const char *root
lnk = linkbuf;
if (root != NULL) {
/* Skip root from checksum, as it is meaningless */
if (strncmp(root, linkbuf, strlen(root)) == 0)
if (strncmp(root, linkbuf, strlen(root)) == 0) {
lnk += strlen(root);
linklen -= strlen(root);
}
}

/* Skip heading slashes */
while(*lnk == '/')
while(*lnk == '/') {
lnk++;
linklen--;
}

return (pkg_checksum_data(lnk, linklen, type));
}
Expand Down

0 comments on commit 1b23a90

Please sign in to comment.