summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/tpax_archive_append.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_append.c
index dfdd92c..caa2606 100644
--- a/src/logic/tpax_archive_append.c
+++ b/src/logic/tpax_archive_append.c
@@ -114,27 +114,30 @@ int tpax_archive_append(
membuf = 0;
fdtmp = -1;
- if ((buf = tpax_get_driver_anon_map_addr(dctx,&buflen)))
- if (buflen >= (cmplen = uctx->st->st_size))
- membuf = buf;
-
- if (ssizeof(sbuf) >= (uctx->st->st_size))
- membuf = sbuf;
-
- /* snapshot */
- if (membuf) {
- if (tpax_file_create_memory_snapshot(
- dctx,*uctx->path,
- uctx->st,membuf) < 0)
- return TPAX_NESTED_ERROR(dctx);
- } else {
- if ((fdtmp = tpax_file_create_tmpfs_snapshot(
- dctx,*uctx->path,
- uctx->st)) < 0)
- return TPAX_NESTED_ERROR(dctx);
-
- if (lseek(fdtmp,0,SEEK_SET) < 0)
- return TPAX_SYSTEM_ERROR(dctx);
+ /* associated data? */
+ if S_ISREG(uctx->st->st_mode) {
+ if ((buf = tpax_get_driver_anon_map_addr(dctx,&buflen)))
+ if (buflen >= (cmplen = uctx->st->st_size))
+ membuf = buf;
+
+ if (ssizeof(sbuf) >= (uctx->st->st_size))
+ membuf = sbuf;
+
+ /* snapshot */
+ if (membuf) {
+ if (tpax_file_create_memory_snapshot(
+ dctx,*uctx->path,
+ uctx->st,membuf) < 0)
+ return TPAX_NESTED_ERROR(dctx);
+ } else {
+ if ((fdtmp = tpax_file_create_tmpfs_snapshot(
+ dctx,*uctx->path,
+ uctx->st)) < 0)
+ return TPAX_NESTED_ERROR(dctx);
+
+ if (lseek(fdtmp,0,SEEK_SET) < 0)
+ return TPAX_SYSTEM_ERROR(dctx);
+ }
}
/* append header */
@@ -147,6 +150,10 @@ int tpax_archive_append(
tpax_set_driver_cpos(dctx,dpos);
+ /* all done? */
+ if (!(S_ISREG(uctx->st->st_mode)))
+ return 0;
+
/* append data from snapshot */
if (fdtmp >= 0) {
if (!buf) {