Message ID | 20211001220017.124893-1-morganamilo@archlinux.org |
---|---|
State | Rejected, archived |
Headers | show |
Series | [1/2] alpm: test access of symlinks not where they point | expand |
On 10/01/21 at 11:00pm, morganamilo wrote: > Fixes FS#69720 > --- > lib/libalpm/util.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c > index 299d287e..e7b049ce 100644 > --- a/lib/libalpm/util.c > +++ b/lib/libalpm/util.c > @@ -1342,11 +1342,11 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a > CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); > snprintf(check_path, len, "%s%s", dir, file); > > - ret = access(check_path, amode); > + ret = faccessat(AT_FDCWD, check_path, amode, AT_SYMLINK_NOFOLLOW); > free(check_path); > } else { > dir = ""; > - ret = access(file, amode); > + ret = faccessat(AT_FDCWD, file, amode, AT_SYMLINK_NOFOLLOW); > } > > if(ret != 0) { AT_SYMLINK_NOFOLLOW is a Linux extension.
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 299d287e..e7b049ce 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -1342,11 +1342,11 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(check_path, len, "%s%s", dir, file); - ret = access(check_path, amode); + ret = faccessat(AT_FDCWD, check_path, amode, AT_SYMLINK_NOFOLLOW); free(check_path); } else { dir = ""; - ret = access(file, amode); + ret = faccessat(AT_FDCWD, file, amode, AT_SYMLINK_NOFOLLOW); } if(ret != 0) {