diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 7e52526e..7c39d9ac 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -1149,7 +1149,9 @@ typedef enum _alpm_progress_t { * make take a while to complete. * @param ctx user-provided context * @param progress the kind of event that is progressing - * @param pkg for package operations, the name of the package being operated on + * @param pkg the name of the package being operated on. if the progress kind + * is a packae operation (add, upgrade, downgrade, reinstall, remove). + * otherwise this will be an empty string. * @param percent the percent completion of the action * @param howmany the total amount of items in the action * @param current the current amount of items completed diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 738bc350..039d2dea 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -589,7 +589,7 @@ void cb_progress(void *ctx, alpm_progress_t event, const char *pkgname, } else { if(current != prevcurrent) { /* update always */ - } else if(!pkgname || percent == prevpercent || + } else if(pkgname[0] == '\0' || percent == prevpercent || get_update_timediff(0) < UPDATE_SPEED_MS) { /* only update the progress bar when we have a package name, the * percentage has changed, and it has been long enough. */ @@ -653,7 +653,7 @@ void cb_progress(void *ctx, alpm_progress_t event, const char *pkgname, * by the output, and then pad it accordingly so we fill the terminal. */ /* len = opr len + pkgname len (if available) + space + null */ - len = strlen(opr) + ((pkgname) ? strlen(pkgname) : 0) + 2; + len = strlen(opr) + strlen(pkgname) + 2; wcstr = calloc(len, sizeof(wchar_t)); /* print our strings to the alloc'ed memory */ #if defined(HAVE_SWPRINTF)