From b4fb201f63152e62c33ef09a0ad2440593f44f5b Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 25 Jul 2018 18:58:32 -0400 Subject: pe_map_raw_image(): use openat and the context's fdcwd. --- src/logic/pe_map_raw_image.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/logic/pe_map_raw_image.c b/src/logic/pe_map_raw_image.c index 8334aa0..91fc738 100644 --- a/src/logic/pe_map_raw_image.c +++ b/src/logic/pe_map_raw_image.c @@ -13,6 +13,7 @@ #include #include +#include "perk_driver_impl.h" #include "perk_errinfo_impl.h" int pe_map_raw_image( @@ -22,12 +23,15 @@ int pe_map_raw_image( int prot, struct pe_raw_image * map) { + int ret; struct stat st; bool fnew; - int ret; + int fdcwd; + + fdcwd = pe_driver_fdcwd(dctx); if ((fnew = (fd < 0))) - fd = open(path,O_RDONLY | O_CLOEXEC); + fd = openat(fdcwd,path,O_RDONLY | O_CLOEXEC); if (fd < 0) return PERK_SYSTEM_ERROR(dctx); -- cgit v1.2.3