diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-05-12 17:49:59 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-05-12 17:49:59 +0000 |
| commit | aaeca3823cf4ef4e2f6e68bfb2af0c5b52b1721c (patch) | |
| tree | e23eab69a6ca60909cdbb4ec8a7347246c200218 | |
| parent | b2bf6be4171f38c77365e3c5ca93a7a2b4e66418 (diff) | |
| download | s6-rc-aaeca3823cf4ef4e2f6e68bfb2af0c5b52b1721c.tar.gz | |
Cleanup on s6-rc-repo-init sync error
| -rw-r--r-- | src/repo/s6-rc-repo-init.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/repo/s6-rc-repo-init.c b/src/repo/s6-rc-repo-init.c index c190bee..c63637b 100644 --- a/src/repo/s6-rc-repo-init.c +++ b/src/repo/s6-rc-repo-init.c @@ -149,7 +149,10 @@ int main (int argc, char const *const *argv) } if (chmod(repotmp, 02755) == -1) + { + cleanup(repotmp) ; strerr_diefu2sys(111, "chmod ", repotmp) ; + } if (rename(repotmp, wgola[GOLA_REPODIR]) == -1) { @@ -185,13 +188,20 @@ int main (int argc, char const *const *argv) lockfd = s6rc_repo_lock(wgola[GOLA_REPODIR], 1) ; if (lockfd == -1) + { + if (!(wgolb & GOLB_UPDATE)) cleanup(wgola[GOLA_REPODIR]) ; strerr_diefu2sys(111, "lock ", wgola[GOLA_REPODIR]) ; + } char sold[repolen + 16] ; memcpy(sold, wgola[GOLA_REPODIR], repolen) ; sold[repolen] = '/' ; - if (!s6rc_repo_makestores(wgola[GOLA_REPODIR], argv, argc, sold + repolen + 1)) _exit(111) ; + if (!s6rc_repo_makestores(wgola[GOLA_REPODIR], argv, argc, sold + repolen + 1)) + { + if (!(wgolb & GOLB_UPDATE)) cleanup(wgola[GOLA_REPODIR]) ; + _exit(111) ; + } if (!(wgolb & GOLB_BARE)) { |
