summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-07-25 18:58:32 -0400
committermidipix <writeonce@midipix.org>2018-07-25 18:58:32 -0400
commitb4fb201f63152e62c33ef09a0ad2440593f44f5b (patch)
treed26410808dc340917c329603e2e71d28d9a4ac4e /src
parent3f9a17455a5ae3c453225684f552d9d2aebec305 (diff)
downloadperk-b4fb201f63152e62c33ef09a0ad2440593f44f5b.tar.bz2
perk-b4fb201f63152e62c33ef09a0ad2440593f44f5b.tar.xz
pe_map_raw_image(): use openat and the context's fdcwd.
Diffstat (limited to 'src')
-rw-r--r--src/logic/pe_map_raw_image.c8
1 files 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 <sys/stat.h>
#include <perk/perk.h>
+#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);