summaryrefslogtreecommitdiffhomepage
path: root/src/meta
diff options
context:
space:
mode:
Diffstat (limited to 'src/meta')
-rw-r--r--src/meta/tpax_init_ustar_header.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/meta/tpax_init_ustar_header.c b/src/meta/tpax_init_ustar_header.c
index 2479e28..5078344 100644
--- a/src/meta/tpax_init_ustar_header.c
+++ b/src/meta/tpax_init_ustar_header.c
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdbool.h>
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
@@ -30,12 +31,12 @@ static void tpax_octal_write(char * ch, ssize_t len, uint64_t val)
}
}
-int tpax_meta_init_ustar_header(
- const struct tpax_driver_ctx * dctx,
+static int tpax_meta_init_ustar_header_impl(
const char * path,
const struct stat * st,
const char * linkname,
- struct tpax_ustar_header * uhdr)
+ struct tpax_ustar_header * uhdr,
+ bool frustar)
{
size_t len;
const char * cap;
@@ -140,7 +141,7 @@ int tpax_meta_init_ustar_header(
tpax_octal_write(uhdr->u_mode,ssizeof(uhdr->u_mode),st->st_mode & TPAX_USTAR_MODE_MASK);
/* u_uid, u_gid, u_uname, u_gname */
- if (dctx->cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_RUSTAR) {
+ if (frustar) {
tpax_octal_write(uhdr->u_uid,ssizeof(uhdr->u_uid),0);
tpax_octal_write(uhdr->u_gid,ssizeof(uhdr->u_gid),0);
} else {
@@ -216,3 +217,21 @@ int tpax_meta_init_ustar_header(
/* all done; caller may now change REGFILE to HARDLINK */
return 0;
}
+
+int tpax_meta_init_ustar_header(
+ const char * path,
+ const struct stat * st,
+ const char * linkname,
+ struct tpax_ustar_header * uhdr)
+{
+ return tpax_meta_init_ustar_header_impl(path,st,linkname,uhdr,false);
+}
+
+int tpax_meta_init_rustar_header(
+ const char * path,
+ const struct stat * st,
+ const char * linkname,
+ struct tpax_ustar_header * uhdr)
+{
+ return tpax_meta_init_ustar_header_impl(path,st,linkname,uhdr,true);
+}