From 51dee16f222c24d152321c789603f0b456112715 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 5 Nov 2008 18:30:28 +0100 Subject: [PATCH] Fix return codes for loop functions. The four different loop functions must set the return value in their private struct because these functions are called from within the osl library which will replace any negative return value by -E_OSL_LOOP. --- select.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/select.c b/select.c index 9a19825..3ec359e 100644 --- a/select.c +++ b/select.c @@ -282,7 +282,7 @@ static int global_summary_loop_function(struct osl_row *row, void *data) err: gsi->ret = ret; gsi->osl_errno = (ret == -E_OSL)? osl_errno : 0; - return -1; + return ret; } static int print_global_summary(struct format_info *fi) @@ -334,7 +334,7 @@ static int user_summary_loop_function(struct osl_row *row, void *data) err: usi->ret = ret; usi->osl_errno = (ret == -E_OSL)? osl_errno : 0; - return -1; + return ret; } static int compute_user_summary(struct user_info *ui, __a_unused void *data) @@ -468,12 +468,14 @@ static int user_list_loop_function(struct osl_row *row, void *data) free(dirname); ret = output("%s", buf); free(buf); + if (ret < 0) + goto err; uli->count--; return ret; err: uli->ret = ret; uli->osl_errno = (ret == -E_OSL)? osl_errno : 0; - return -1; + return ret; } static int print_user_list(struct user_info *ui, void *data) @@ -536,6 +538,8 @@ static int global_list_loop_function(struct osl_row *row, void *data) free(dirname); ret = output("%s", buf); free(buf); + if (ret < 0) + goto err; if (gli->count > 0) gli->count--; return ret; -- 2.39.2