diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-10-21 18:03:48 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2025-10-21 18:03:48 +0000 |
| commit | 3b9836248ed7f5164140d63e96ece21973fc43f7 (patch) | |
| tree | 193242a4b634c84d712d8260e7707eae1be53601 /src/repo | |
| parent | d71f18b44e4168e2d942b503110af5b5314364b5 (diff) | |
| download | s6-rc-3b9836248ed7f5164140d63e96ece21973fc43f7.tar.gz | |
add getserviceflags and use it in fillset; add some doc
Diffstat (limited to 'src/repo')
| -rw-r--r-- | src/repo/s6-rc-repo-init.c | 5 | ||||
| -rw-r--r-- | src/repo/s6-rc-repo-sync.c | 5 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-change.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-copy.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/src/repo/s6-rc-repo-init.c b/src/repo/s6-rc-repo-init.c index 335d83f..3c353fe 100644 --- a/src/repo/s6-rc-repo-init.c +++ b/src/repo/s6-rc-repo-init.c @@ -189,7 +189,8 @@ int main (int argc, char const *const *argv) if (!(wgolb & GOLB_BARE)) { - if (!s6rc_repo_sync(wgola[GOLA_REPODIR], verbosity, wgola[GOLA_FDHUSER])) + int r = s6rc_repo_sync(wgola[GOLA_REPODIR], verbosity, wgola[GOLA_FDHUSER]) ; + if (r <= 0) { char stores[repolen + 8] ; char snew[repolen + 16] ; @@ -200,7 +201,7 @@ int main (int argc, char const *const *argv) if (!atomic_symlink4(sold + repolen + 1, stores, snew + repolen + 1, 15)) strerr_diefu7sys(111, "atomically switch back stores at ", wgola[GOLA_REPODIR], " - old store is ", sold + repolen + 1, " and new (invalid) store is ", snew + repolen + 1, " - reported error was") ; rm_rf(snew) ; - _exit(111) ; + _exit(r ? 111 : 1) ; } } diff --git a/src/repo/s6-rc-repo-sync.c b/src/repo/s6-rc-repo-sync.c index 474eec5..ce04d7b 100644 --- a/src/repo/s6-rc-repo-sync.c +++ b/src/repo/s6-rc-repo-sync.c @@ -32,7 +32,7 @@ int main (int argc, char const *const *argv) char const *wgola[GOLA_N] = { 0 } ; unsigned int verbosity = 1 ; unsigned int golc ; - int fdlock ; + int fdlock, r ; PROG = "s6-rc-repo-sync" ; wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; @@ -45,7 +45,8 @@ int main (int argc, char const *const *argv) fdlock = s6rc_repo_lock(wgola[GOLA_REPODIR], 1) ; if (fdlock == -1) strerr_diefu2sys(111, "lock ", wgola[GOLA_REPODIR]) ; - if (!s6rc_repo_sync(wgola[GOLA_REPODIR], verbosity, wgola[GOLA_FDHUSER])) _exit(111) ; + r = s6rc_repo_sync(wgola[GOLA_REPODIR], verbosity, wgola[GOLA_FDHUSER]) ; + if (r <= 0) _exit(r ? 111 : 1) ; if (!s6rc_repo_touch(wgola[GOLA_REPODIR])) _exit(111) ; _exit(0) ; diff --git a/src/repo/s6-rc-set-change.c b/src/repo/s6-rc-set-change.c index 188b11c..2758fa6 100644 --- a/src/repo/s6-rc-set-change.c +++ b/src/repo/s6-rc-set-change.c @@ -127,7 +127,7 @@ int main (int argc, char const *const *argv) newsub = bsearch(argv[1], accepted_subs, sizeof(accepted_subs)/sizeof(struct subname_s), sizeof(struct subname_s), &subname_cmp) ; if (!newsub) strerr_dief2x(100, "unrecognized state change directive:", argv[1]) ; if (newsub->sub == 3 && !(wgolb & GOLB_FORCE_ESSENTIAL)) - strerr_dief1x(100, " artificially mark a service as essential without --force-essential") ; + strerr_diefu1x(10, " artificially mark a service as essential without --force-essential") ; fdlock = s6rc_repo_lock(wgola[GOLA_REPODIR], 1) ; if (fdlock == -1) strerr_diefu2sys(111, "lock ", wgola[GOLA_REPODIR]) ; diff --git a/src/repo/s6-rc-set-copy.c b/src/repo/s6-rc-set-copy.c index 372a23c..3093aaf 100644 --- a/src/repo/s6-rc-set-copy.c +++ b/src/repo/s6-rc-set-copy.c @@ -79,7 +79,7 @@ static inline void docopy (char const *repo, char const *srcname, char const *ds if (r == -1) strerr_diefu2sys(111, "readlink ", dst) ; if (r != dstlen + 8) strerr_dief3x(102, "symlink ", dst, "doesn't point to a valid name") ; } - else strerr_dief4x(100, "set ", dstname, " already exists in repository ", repo) ; + else strerr_dief4x(1, "set ", dstname, " already exists in repository ", repo) ; memcpy(realsrc, src, repolen + 9) ; r = readlink(src, realsrc + repolen + 9, srclen + 9) ; |
