diff options
-rw-r--r-- | include/tpax/tpax.h | 4 | ||||
-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 |
4 files changed, 8 insertions, 14 deletions
diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h index 17fe7d8..e12a44b 100644 --- a/include/tpax/tpax.h +++ b/include/tpax/tpax.h @@ -168,10 +168,10 @@ tpax_api int tpax_output_error_vector (const struct tpax_driver_ctx *); tpax_api int tpax_init_ustar_header (const struct tpax_driver_ctx *, const char *, const struct stat *, const char *, struct tpax_ustar_header *); -tpax_api int tpax_file_create_memory_snapshot (const struct tpax_driver_ctx *, const char *, +tpax_api int tpax_file_create_memory_snapshot (const struct tpax_driver_ctx *, int, const char *, const struct stat *, void *); -tpax_api int tpax_file_create_tmpfs_snapshot (const struct tpax_driver_ctx *, const char *, +tpax_api int tpax_file_create_tmpfs_snapshot (const struct tpax_driver_ctx *, int, const char *, const struct stat *); /* package info */ 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); } |