xbps-query: generate -o output from a single printf.

Else parts written by multiple threads can become mixed up.
This commit is contained in:
Christian Neukirchen 2016-01-20 13:41:13 +01:00
parent 0a5f86e772
commit 034d3591b3
2 changed files with 13 additions and 8 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.52 (???):
* xbps-query(1): fix a bug where the output of -o became mixed up
when running on multiple cores.
xbps-0.51 (2015-12-12):
* zsh completion: added -U/--unpack-only support for xbps-install(1).

View File

@ -76,17 +76,19 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd,
xbps_dictionary_get_cstring_nocopy(obj, "target", &tgt);
if (ffd->rematch) {
if (regexec(&ffd->regex, filestr, 0, 0, 0) == 0) {
printf("%s: %s ", pkgver, filestr);
if (tgt)
printf("-> %s ", tgt);
printf("(%s)\n", typestr);
printf("%s: %s%s%s (%s)\n",
pkgver, filestr,
tgt ? " -> " : "",
tgt ? tgt : "",
typestr);
}
} else {
if ((fnmatch(ffd->pat, filestr, FNM_PERIOD)) == 0) {
printf("%s: %s ", pkgver, filestr);
if (tgt)
printf("-> %s ", tgt);
printf("(%s)\n", typestr);
printf("%s: %s%s%s (%s)\n",
pkgver, filestr,
tgt ? " -> " : "",
tgt ? tgt : "",
typestr);
}
}
}