aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs6rc/s6rc_repo_sync.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-08-19 16:29:18 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2025-08-19 16:29:18 +0000
commitbfdfb6e54738a6a26d146eadf025646fa65c7b0c (patch)
tree34ff6e5d263cdf9d3115c6f6aa4667f4d0ee8db0 /src/libs6rc/s6rc_repo_sync.c
parenta92aa0997e0d367e396b02dc2d55d0c0a3cbbc38 (diff)
downloads6-rc-bfdfb6e54738a6a26d146eadf025646fa65c7b0c.tar.gz
Almost got a full sync, still need the adjustment heuristic
Diffstat (limited to 'src/libs6rc/s6rc_repo_sync.c')
-rw-r--r--src/libs6rc/s6rc_repo_sync.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs6rc/s6rc_repo_sync.c b/src/libs6rc/s6rc_repo_sync.c
index 8ff1137..e3d71fd 100644
--- a/src/libs6rc/s6rc_repo_sync.c
+++ b/src/libs6rc/s6rc_repo_sync.c
@@ -27,7 +27,7 @@ static inline void cleanup (char const *ato, char const *bun)
errno = e ;
}
-static int s6rc_repo_syncsub (char const *repo, char const *set, char const *sub, uint32_t where, stralloc *sa, genalloc *ga, unsigned int verbosity)
+static int unlink_stales_in_sub (char const *repo, char const *set, char const *sub, uint32_t where, stralloc *sa, genalloc *ga, unsigned int verbosity)
{
size_t repolen = strlen(repo) ;
size_t setlen = strlen(set) ;
@@ -91,14 +91,14 @@ static int s6rc_repo_syncsub (char const *repo, char const *set, char const *sub
static inline int s6rc_repo_syncset (char const *repo, size_t repolen, char const *set, stralloc *sa, genalloc *ga, unsigned int verbosity)
{
- static char const subs[3][7] = { "masked", "active", "onboot" } ;
for (unsigned int i = 0 ; i < 3 ; i++)
- if (s6rc_repo_syncsub(repo, set, subs[i], i, sa, ga, verbosity)) goto err ;
+ if (unlink_stales_in_sub(repo, set, s6rc_repo_sublist[i], i, sa, ga, verbosity)) goto err ;
- size_t n = genalloc_len(size_t, ga) ;
- if (!n)
{
- if (!s6rc_repo_fillset(repo, set)) goto err ;
+ size_t n = genalloc_len(size_t, ga) ;
+ char const *stillhere[n + !n] ;
+ for (size_t i = 0 ; i < n ; i++) stillhere[i] = sa->s + genalloc_s(size_t, ga)[i] ;
+ if (!s6rc_repo_fillset(repo, set, stillhere, n)) goto err ;
}
sa->len = 0 ;