Skip to content

Commit

Permalink
extract: accept /usr/local/lib/compat as symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
bapt committed Jan 23, 2025
1 parent 4383e4d commit e5f4f3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions libpkg/pkg_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,8 +1446,11 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
* Extract the files on disk.
*/
if (extract) {
char *compat;
pkg_register_cleanup_callback(pkg_rollback_cb, pkg);
vec_push(context.symlinks_allowed, pkg->prefix);
vec_push(context.symlinks_allowed, xstrdup(pkg->prefix));
xasprintf(&compat, "%s/lib/compat", pkg->prefix);
vec_push(context.symlinks_allowed, compat);
retcode = do_extract(a, ae, nfiles, local, &tempdirs, &context);
pkg_unregister_cleanup_callback(pkg_rollback_cb, pkg);
if (retcode != EPKG_OK) {
Expand Down Expand Up @@ -1546,7 +1549,7 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
}

cleanup:
vec_free(context.symlinks_allowed);
vec_free_and_free(context.symlinks_allowed, free);
free(context.symlinks_allowed);

if (openxact)
Expand Down
2 changes: 1 addition & 1 deletion libpkg/private/add.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

struct pkg_add_context {
int rootfd;
c_charv_t *symlinks_allowed;
charv_t *symlinks_allowed;
struct pkgdb *db;
struct pkg *pkg;
};
Expand Down

0 comments on commit e5f4f3a

Please sign in to comment.