diff options
Diffstat (limited to 'store')
| -rw-r--r-- | store/store-log.c | 5 | ||||
| -rw-r--r-- | store/store-tree.c | 2 | ||||
| -rw-r--r-- | store/test-log.c | 3 | ||||
| -rw-r--r-- | store/test-tree-store.c | 3 |
4 files changed, 11 insertions, 2 deletions
diff --git a/store/store-log.c b/store/store-log.c index f73d2bc..7b6f00c 100644 --- a/store/store-log.c +++ b/store/store-log.c @@ -493,7 +493,10 @@ PureResult pure_image_write(const char *directory, const char *name, bool (*next put64(head + 8, 0); /* its length, once known */ Digest digest = {0}; bool ok = write_all(fd, head, sizeof(head), 0), produced = true; - uint64_t at = sizeof(head), started = 0; + uint64_t at = sizeof(head); +#if defined(__linux__) + uint64_t started = 0; /* the bytes handed to the device */ +#endif for (PureSpan chunk; ok && (produced = next(context, &chunk)) && chunk.size;) for (size_t done = 0; ok && done < chunk.size;) { size_t take = chunk.size - done < STEP ? chunk.size - done : STEP; diff --git a/store/store-tree.c b/store/store-tree.c index ecdced6..3404edd 100644 --- a/store/store-tree.c +++ b/store/store-tree.c @@ -1202,7 +1202,7 @@ static PureResult publish(Session *session, Writer *writer, size_t count, const written = find(&session->tree, catalog, keys[i], &index, &found, ¤t, &stored) && rebuild(&session->tree, catalog, index * RECORD, found ? RECORD : 0, (PureSpan){record, RECORD}, &updated); - catalog = updated; + if (written) catalog = updated; } written = written && write_root(&session->tree, writer, &catalog, false) && flush(writer); /* Unpublished bytes stay in the tail; the next commit overwrites them. */ diff --git a/store/test-log.c b/store/test-log.c index 451f354..6e81c4c 100644 --- a/store/test-log.c +++ b/store/test-log.c @@ -5,6 +5,9 @@ * model kept, and its files stay as many as the unreleased entries need. * Then list images: written whole, read back, refused when damaged. */ #define _POSIX_C_SOURCE 200809L +#ifdef __APPLE__ +#define _DARWIN_C_SOURCE /* mkdtemp, which _POSIX_C_SOURCE hides there */ +#endif #include "log.h" #include "store.h" #include <dirent.h> diff --git a/store/test-tree-store.c b/store/test-tree-store.c index 2ef9d22..2ffbc39 100644 --- a/store/test-tree-store.c +++ b/store/test-tree-store.c @@ -1,4 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#ifdef __APPLE__ +#define _DARWIN_C_SOURCE /* mkdtemp, which _POSIX_C_SOURCE hides there */ +#endif #include "store.h" #include "state.h" #include <assert.h> |
