[pacman-dev] [PATCH] hook.c: replace fstatat with stat

Andrew Gregory andrew.gregory.8 at gmail.com
Tue Jun 28 02:23:43 UTC 2016


macOS < 10.10 do not provide fstatat.  We were constructing the full
path to the hook file for all other operations anyway, so there was no
real benefit to using fstatat.

Fixes FS#49771

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 lib/libalpm/hook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/hook.c b/lib/libalpm/hook.c
index 9b4f215..ccde225 100644
--- a/lib/libalpm/hook.c
+++ b/lib/libalpm/hook.c
@@ -675,7 +675,7 @@ int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when)
 				continue;
 			}
 
-			if(fstatat(dirfd(d), entry->d_name, &buf, 0) != 0) {
+			if(stat(path, &buf) != 0) {
 				_alpm_log(handle, ALPM_LOG_ERROR,
 						_("could not stat file %s: %s\n"), path, strerror(errno));
 				ret = -1;
-- 
2.9.0


More information about the pacman-dev mailing list