summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/logic/tpax_archive_append.c4
-rw-r--r--src/logic/tpax_file_create_memory_snapshot.c7
-rw-r--r--src/logic/tpax_file_create_tmpfs_snapshot.c7
3 files changed, 6 insertions, 12 deletions
diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_append.c
index caa2606..be9b2fa 100644
--- a/src/logic/tpax_archive_append.c
+++ b/src/logic/tpax_archive_append.c
@@ -126,12 +126,12 @@ int tpax_archive_append(
/* snapshot */
if (membuf) {
if (tpax_file_create_memory_snapshot(
- dctx,*uctx->path,
+ dctx,fdat,*uctx->path,
uctx->st,membuf) < 0)
return TPAX_NESTED_ERROR(dctx);
} else {
if ((fdtmp = tpax_file_create_tmpfs_snapshot(
- dctx,*uctx->path,
+ dctx,fdat,*uctx->path,
uctx->st)) < 0)
return TPAX_NESTED_ERROR(dctx);
diff --git a/src/logic/tpax_file_create_memory_snapshot.c b/src/logic/tpax_file_create_memory_snapshot.c
index 7db21ea..bbcd1df 100644
--- a/src/logic/tpax_file_create_memory_snapshot.c
+++ b/src/logic/tpax_file_create_memory_snapshot.c
@@ -25,6 +25,7 @@
int tpax_file_create_memory_snapshot(
const struct tpax_driver_ctx * dctx,
+ int fdat,
const char * path,
const struct stat * srcst,
void * addr)
@@ -44,11 +45,7 @@ int tpax_file_create_memory_snapshot(
return TPAX_CUSTOM_ERROR(dctx,TPAX_ERR_REGION_SIZE);
/* open */
- fd = openat(
- tpax_driver_fdcwd(dctx),path,
- O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
-
- if (fd < 0)
+ if ((fd = openat(fdat,path,O_CLOEXEC|O_NOCTTY|O_NOFOLLOW,0)) < 0)
return TPAX_SYSTEM_ERROR(dctx);
/* stat compare */
diff --git a/src/logic/tpax_file_create_tmpfs_snapshot.c b/src/logic/tpax_file_create_tmpfs_snapshot.c
index 3bb48b7..bdfa396 100644
--- a/src/logic/tpax_file_create_tmpfs_snapshot.c
+++ b/src/logic/tpax_file_create_tmpfs_snapshot.c
@@ -26,6 +26,7 @@
int tpax_file_create_tmpfs_snapshot(
const struct tpax_driver_ctx * dctx,
+ int fdat,
const char * path,
const struct stat * srcst)
{
@@ -55,11 +56,7 @@ int tpax_file_create_tmpfs_snapshot(
}
/* open */
- fdsrc = openat(
- tpax_driver_fdcwd(dctx),path,
- O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
-
- if (fdsrc < 0) {
+ if ((fdsrc = openat(fdat,path,O_CLOEXEC|O_NOCTTY|O_NOFOLLOW,0)) < 0) {
close(fdtmp);
return TPAX_SYSTEM_ERROR(dctx);
}