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-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): xbps-0.51 (2015-12-12):
* zsh completion: added -U/--unpack-only support for xbps-install(1). * 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); xbps_dictionary_get_cstring_nocopy(obj, "target", &tgt);
if (ffd->rematch) { if (ffd->rematch) {
if (regexec(&ffd->regex, filestr, 0, 0, 0) == 0) { if (regexec(&ffd->regex, filestr, 0, 0, 0) == 0) {
printf("%s: %s ", pkgver, filestr); printf("%s: %s%s%s (%s)\n",
if (tgt) pkgver, filestr,
printf("-> %s ", tgt); tgt ? " -> " : "",
printf("(%s)\n", typestr); tgt ? tgt : "",
typestr);
} }
} else { } else {
if ((fnmatch(ffd->pat, filestr, FNM_PERIOD)) == 0) { if ((fnmatch(ffd->pat, filestr, FNM_PERIOD)) == 0) {
printf("%s: %s ", pkgver, filestr); printf("%s: %s%s%s (%s)\n",
if (tgt) pkgver, filestr,
printf("-> %s ", tgt); tgt ? " -> " : "",
printf("(%s)\n", typestr); tgt ? tgt : "",
typestr);
} }
} }
} }