aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda <ricardo@ribalda.com>2020-04-05 11:40:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-26 11:42:24 +0100
commitbdff3b0db6eaa30600a66671184ddce29ef16c7d (patch)
tree00f024ee94dffaa85fde60f2777745a406666318
parent1ef33cf08937783c36613f37e4e909267be60f73 (diff)
downloadpseudo-bdff3b0db6eaa30600a66671184ddce29ef16c7d.tar.gz
pseudo-bdff3b0db6eaa30600a66671184ddce29ef16c7d.tar.bz2
pseudo-bdff3b0db6eaa30600a66671184ddce29ef16c7d.zip
pseudo: On a DB fixup remove files that do not exist anymore
If the user decides to fix a database, remove the files that do not exist anymore. If only DB test is selected do not change the behaviour (return error). Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137045] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--pseudo.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/pseudo.c b/pseudo.c
index 0f5850e..d430a40 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -1087,9 +1087,15 @@ pseudo_db_check(int fix) {
int fixup_needed = 0;
pseudo_debug(PDBGF_DB, "Checking <%s>\n", m->path);
if (lstat(m->path, &buf)) {
- errors = EXIT_FAILURE;
- pseudo_diag("can't stat <%s>\n", m->path);
- continue;
+ if (!fix) {
+ pseudo_diag("can't stat <%s>\n", m->path);
+ errors = EXIT_FAILURE;
+ continue;
+ } else {
+ pseudo_debug(PDBGF_DB, "can't stat <%s>\n", m->path);
+ fixup_needed = 2;
+ goto do_fixup;
+ }
}
/* can't check for device type mismatches, uid/gid, or
* permissions, because those are the very things we
@@ -1125,6 +1131,7 @@ pseudo_db_check(int fix) {
S_ISDIR(m->mode));
fixup_needed = 2;
}
+ do_fixup:
if (fixup_needed) {
/* in fixup mode, either delete (mismatches) or
* correct (dev/ino).