1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Improve cleanup process

In some cases, following a fallback from RRDP to RSYNC, files are
moved to the wrong place. With this change, only rsync repositories
are considered when looking up where to move DIR_TEMP files.

repo.c requires more study, this fix might be a bandaid for a problem
not fully understood.

"put it in" claudio@ OK tb@
This commit is contained in:
job 2024-12-19 13:23:38 +00:00
parent 72dde9b872
commit 05a19cc6f2

View File

@ -1,4 +1,4 @@
/* $OpenBSD: repo.c,v 1.70 2024/11/13 12:51:04 tb Exp $ */ /* $OpenBSD: repo.c,v 1.71 2024/12/19 13:23:38 job Exp $ */
/* /*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -1264,6 +1264,20 @@ repo_byid(unsigned int id)
return NULL; return NULL;
} }
static struct repo *
repo_rsync_bypath(const char *path)
{
struct repo *rp;
SLIST_FOREACH(rp, &repos, entry) {
if (rp->rsync == NULL)
continue;
if (strcmp(rp->basedir, path) == 0)
return rp;
}
return NULL;
}
/* /*
* Find repository by base path. * Find repository by base path.
*/ */
@ -1892,7 +1906,8 @@ repo_cleanup_entry(FTSENT *e, struct filepath_tree *tree, int cachefd)
} }
if (e->fts_level == 3 && fts_state.type == RSYNC_DIR) { if (e->fts_level == 3 && fts_state.type == RSYNC_DIR) {
/* .rsync/rpki.example.org/repository */ /* .rsync/rpki.example.org/repository */
fts_state.rp = repo_bypath(path + strlen(".rsync/")); fts_state.rp = repo_rsync_bypath(path +
strlen(".rsync/"));
} }
break; break;
case FTS_DP: case FTS_DP: