util/testdb: don't return crazy error values

With some contrived examples, you could easily make testdb return a very
high error count, which could easily overflow the 8-bit unsigned integer
limit. Instead, simply return 1 or 0 based on whether errors were found.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2012-04-24 20:59:24 -05:00
parent 1583a2079c
commit 20ff0cd40f
1 changed files with 4 additions and 4 deletions

View File

@ -253,7 +253,7 @@ static void usage(void)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int ret = 0; int errors = 0;
alpm_errno_t err; alpm_errno_t err;
const char *dbpath = DBPATH; const char *dbpath = DBPATH;
int a = 1; int a = 1;
@ -285,13 +285,13 @@ int main(int argc, char *argv[])
alpm_option_set_logcb(handle, output_cb); alpm_option_set_logcb(handle, output_cb);
if(!dbnames) { if(!dbnames) {
ret = check_localdb(); errors = check_localdb();
} else { } else {
ret = check_syncdbs(dbnames); errors = check_syncdbs(dbnames);
alpm_list_free(dbnames); alpm_list_free(dbnames);
} }
cleanup(ret); cleanup(errors > 0);
} }
/* vim: set ts=2 sw=2 noet: */ /* vim: set ts=2 sw=2 noet: */