summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-04 05:10:01 -0400
committermidipix <writeonce@midipix.org>2018-08-04 05:21:03 -0400
commite8da73cbb3075eefffb99d2e10002fd1931e8ebd (patch)
tree4245f7bef593c078eb97bf6b78030a4b794bc13e
parent816f06559aa185c484f4615ae13430f52d55b084 (diff)
downloadsofort-e8da73cbb3075eefffb99d2e10002fd1931e8ebd.tar.bz2
sofort-e8da73cbb3075eefffb99d2e10002fd1931e8ebd.tar.xz
sfrt_map_input(): use openat and the context's fdcwd.
-rw-r--r--src/logic/sfrt_map_input.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/logic/sfrt_map_input.c b/src/logic/sfrt_map_input.c
index d73ace6..aba0427 100644
--- a/src/logic/sfrt_map_input.c
+++ b/src/logic/sfrt_map_input.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <sofort/sofort.h>
+#include "sofort_driver_impl.h"
#include "sofort_errinfo_impl.h"
int sfrt_map_input(
@@ -16,12 +17,15 @@ int sfrt_map_input(
int prot,
struct sfrt_input * map)
{
+ int ret;
struct stat st;
bool fnew;
- int ret;
+ int fdcwd;
+
+ fdcwd = sfrt_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 SFRT_SYSTEM_ERROR(dctx);