]> git.tuebingen.mpg.de Git - adu.git/commitdiff
Fix user summary accounting if pattern is given.
authorAndre Noll <maan@systemlinux.org>
Sun, 9 Jun 2013 15:48:36 +0000 (17:48 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 9 Jun 2013 17:47:54 +0000 (19:47 +0200)
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

index df68b67073bf41116859eaac633a2c5d0a835396..15ad7070844da6915970eb992df8d686f8408d81 100644 (file)
--- 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);