xbps-query: check regcomp() return value.
This commit is contained in:
@ -116,7 +116,9 @@ search_array_cb(struct xbps_handle *xhp _unused,
|
||||
vpkgfound = true;
|
||||
|
||||
if (sd->regex) {
|
||||
regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB);
|
||||
if (regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
return errno;
|
||||
|
||||
if ((regexec(®ex, pkgver, 0, 0, 0) == 0) ||
|
||||
(regexec(®ex, desc, 0, 0, 0) == 0)) {
|
||||
xbps_array_add_cstring_nocopy(sd->results, pkgver);
|
||||
@ -140,7 +142,8 @@ search_array_cb(struct xbps_handle *xhp _unused,
|
||||
for (unsigned int i = 0; i < xbps_array_count(obj2); i++) {
|
||||
xbps_array_get_cstring_nocopy(obj2, i, &str);
|
||||
if (sd->regex) {
|
||||
regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB);
|
||||
if (regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
return errno;
|
||||
if (regexec(®ex, str, 0, 0, 0) == 0) {
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
printf("%s: %s (%s)\n", pkgver, str, sd->repourl);
|
||||
@ -162,7 +165,8 @@ search_array_cb(struct xbps_handle *xhp _unused,
|
||||
/* property is a string */
|
||||
str = xbps_string_cstring_nocopy(obj2);
|
||||
if (sd->regex) {
|
||||
regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB);
|
||||
if (regcomp(®ex, sd->pat, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
return errno;
|
||||
if (regexec(®ex, str, 0, 0, 0) == 0) {
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
printf("%s: %s (%s)\n", pkgver, str, sd->repourl);
|
||||
|
Reference in New Issue
Block a user