diff options
author | midipix <writeonce@midipix.org> | 2021-04-20 22:15:00 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-04-20 19:27:28 +0000 |
commit | a2aed59db7bcb67695a252b11ffb273c4af4e2a4 (patch) | |
tree | 68e774767000bd617e5c7cfbc992ec2b32b108df /src/logic | |
parent | 00bc9c19cdd57be69d8ab8ac9d0459efc25aab6a (diff) | |
download | tpax-a2aed59db7bcb67695a252b11ffb273c4af4e2a4.tar.bz2 tpax-a2aed59db7bcb67695a252b11ffb273c4af4e2a4.tar.xz |
tpax_file_create_{memory|tmpfs}_snapshot(): added an explicit fdat argument.
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/tpax_archive_append.c | 4 | ||||
-rw-r--r-- | src/logic/tpax_file_create_memory_snapshot.c | 7 | ||||
-rw-r--r-- | src/logic/tpax_file_create_tmpfs_snapshot.c | 7 |
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); } |