diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-10-15 08:19:48 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-10-15 08:19:48 +0000 |
| commit | db3fb428599c9c8fe105dcf4ba8d1c914c54cc26 (patch) | |
| tree | f83ab9920c39916777a35e5034a4cb9f43614da8 /src/repo/s6rc_repo_read_major.c | |
| parent | 91a0655557e707977f583b2142bda898ee599fd8 (diff) | |
| download | s6-rc-db3fb428599c9c8fe105dcf4ba8d1c914c54cc26.tar.gz | |
If a db format upgrade is necessary, we need to compile the snapshot
with the new s6-rc-compile. There's data we need to pass to it that
isn't stored (options passed when committing the original set), so
we store it in the db itself (patching s6-rc-compile). We modify
the s6-rc-compile wrappers to pass all this metadata.
Next, we will compile the snapshot.
Diffstat (limited to 'src/repo/s6rc_repo_read_major.c')
| -rw-r--r-- | src/repo/s6rc_repo_read_major.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/repo/s6rc_repo_read_major.c b/src/repo/s6rc_repo_read_major.c index 08d646b..1501fe2 100644 --- a/src/repo/s6rc_repo_read_major.c +++ b/src/repo/s6rc_repo_read_major.c @@ -16,15 +16,12 @@ uint32_t s6rc_repo_read_major (char const *compiled) size_t clen = strlen(compiled) ; ssize_t r ; uint32_t res ; - char tmp[UINT32_FMT] ; - char fn[clen + 7] ; + char pack[5] ; + char fn[clen + 16] ; memcpy(fn, compiled, clen) ; - memcpy(fn + clen, "/major", 7) ; - r = openreadnclose(fn, tmp, UINT32_FMT) ; - if (r == -1) return errno == ENOENT ? 7 : 0 ; /* up to 0.7.0.0 doesn't have db/major */ - if (!r) return 0 ; - if (tmp[r] != '\n') return (errno = EPROTO, 0) ; - tmp[r] = 0 ; - if (uint320_scan(tmp, &res) != r) return (errno = EPROTO, 0) ; + memcpy(fn + clen, "/metainfo/major", 16) ; + r = openreadnclose(fn, pack, 5) ; + if (r != 4) return r == -1 && errno == ENOENT ? 7 : 0 ; /* up to 0.7.0.0 doesn't have metainfo */ + uint32_unpack_big(pack, &res) ; return res ; } |
