From 3a51a868784e755c34f19a16970118936fbf299f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 9 Jun 2013 17:48:36 +0200 Subject: [PATCH] Fix user summary accounting if pattern is given. In user summary select mode we iterate over each row in the user info table and get the directory name from the number stored in the row. Next we match this name against the given pattern and only take matching directories into account for the user summary. Currently we call get_dir_name_of_row(), but this is wrong: Since we iterate over the user info table, we must call get_dir_name_of_user_row() instead as the former function expects a pointer to a dir table row. This bug caused wrong directory names to be matched against the pattern, hence the results of the user summary were incorrect. --- select.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/select.c b/select.c index df68b67..15ad707 100644 --- a/select.c +++ b/select.c @@ -436,6 +436,7 @@ static int print_global_summary(struct format_info *fi) return output("%s", select_conf.trailer_arg); } +/* row: a pointer to a row of the *user* table */ static int user_summary_loop_function(struct osl_row *row, void *data) { struct user_summary_info *usi = data; @@ -444,7 +445,7 @@ static int user_summary_loop_function(struct osl_row *row, void *data) if (usi->preg) { char *dirname; - ret = get_dir_name_of_row(row, &dirname); + ret = get_dir_name_of_user_row(row, usi->ui, &dirname); if (ret < 0) goto err; ret = dir_is_admissible(dirname, usi->preg, usi->inverse_matching); -- 2.39.5