Do not increment on every database error to avoid overflow

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2023-11-29 11:28:13 +10:00
parent d56e9ed083
commit 0f512ae46e

View file

@ -103,7 +103,7 @@ static int check_db_missing_deps(alpm_list_t *pkglist)
pm_printf(ALPM_LOG_ERROR, "missing '%s' dependency for '%s'\n",
depstring, miss->target);
free(depstring);
ret++;
ret = 1;
}
alpm_list_free_inner(data, (alpm_list_fn_free)alpm_depmissing_free);
alpm_list_free(data);
@ -135,12 +135,12 @@ static int check_db_local_files(void)
snprintf(path, PATH_MAX, "%slocal/%s/desc", dbpath, ent->d_name);
if(access(path, F_OK)) {
pm_printf(ALPM_LOG_ERROR, "'%s': description file is missing\n", ent->d_name);
ret++;
ret = 1;
}
snprintf(path, PATH_MAX, "%slocal/%s/files", dbpath, ent->d_name);
if(access(path, F_OK)) {
pm_printf(ALPM_LOG_ERROR, "'%s': file list is missing\n", ent->d_name);
ret++;
ret = 1;
}
}
closedir(dbdir);
@ -158,7 +158,7 @@ static int check_db_local_package_conflicts(alpm_list_t *pkglist)
alpm_conflict_t *conflict = i->data;
pm_printf(ALPM_LOG_ERROR, "'%s' conflicts with '%s'\n",
alpm_pkg_get_name(conflict->package1), alpm_pkg_get_name(conflict->package2));
ret++;
ret = 1;
}
alpm_list_free_inner(data, (alpm_list_fn_free)alpm_conflict_free);
alpm_list_free(data);
@ -228,7 +228,7 @@ static int check_db_local_filelist_conflicts(alpm_list_t *pkglist)
alpm_pkg_get_name(prev_fileitem->pkg),
alpm_pkg_get_name(fileitem->pkg),
fileitem->file->name);
ret++;
ret = 1;
}
prev_fileitem = fileitem;
}