From: claudio Date: Thu, 30 May 2024 12:33:15 +0000 (+0000) Subject: Properly setup the fts_state in the FTS_D case. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=477583a66d28e61e63d2938005b2ec484ca13f3c;p=openbsd Properly setup the fts_state in the FTS_D case. At fts_level 1 the state needs to be fully reset since we most probably exited from a directory at level 1 and entered a new dir at level 1. Without this empty directories remained since the fts_state.type was wrong for those entries. Noticed by job@, OK tb@ --- diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index 43432cfd8c1..15ff513f00a 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.58 2024/05/20 15:51:43 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.59 2024/05/30 12:33:15 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1787,17 +1787,19 @@ repo_cleanup_entry(FTSENT *e, struct filepath_tree *tree, int cachefd) } break; case FTS_D: - if (e->fts_level == FTS_ROOTLEVEL) + if (e->fts_level == FTS_ROOTLEVEL) { fts_state.type = BASE_DIR; + fts_state.rp = NULL; + } if (e->fts_level == 1) { /* rpki.example.org or .rrdp / .rsync */ - if (strcmp(".rsync", e->fts_name) == 0) { + if (strcmp(".rsync", e->fts_name) == 0) fts_state.type = RSYNC_DIR; - fts_state.rp = NULL; - } else if (strcmp(".rrdp", e->fts_name) == 0) { + else if (strcmp(".rrdp", e->fts_name) == 0) fts_state.type = RRDP_DIR; - fts_state.rp = NULL; - } + else + fts_state.type = BASE_DIR; + fts_state.rp = NULL; } if (e->fts_level == 2) { /* rpki.example.org/repository or .rrdp/hashdir */