Skip to content

Commit ce36340

Browse files
classabbyampDuncaen
authored andcommitted
bin/xbps-uhelper: don't use xbps_verbose_printf when libxbps isn't init'd
1 parent d25cedd commit ce36340

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

bin/xbps-uhelper/main.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,16 @@ main(int argc, char **argv)
355355
/* NOTREACHED */
356356
}
357357
rv = xbps_pkgpattern_match(argv[1], argv[2]);
358-
if (rv >= 0)
359-
xbps_verbose_printf("%s %s %s\n",
360-
argv[1],
361-
(rv == 1) ? "matches" : "does not match",
362-
argv[2]);
363-
else if (flags & XBPS_FLAG_VERBOSE)
358+
if (rv >= 0) {
359+
if (flags & XBPS_FLAG_VERBOSE) {
360+
fprintf(stderr, "%s %s %s\n",
361+
argv[1],
362+
(rv == 1) ? "matches" : "does not match",
363+
argv[2]);
364+
}
365+
} else if (flags & XBPS_FLAG_VERBOSE) {
364366
xbps_error_printf("%s: not a pattern\n", argv[2]);
367+
}
365368
exit(rv);
366369
} else if (strcmp(argv[0], "cmpver") == 0) {
367370
/* Compare two version strings, installed vs required */
@@ -371,10 +374,12 @@ main(int argc, char **argv)
371374
}
372375

373376
rv = xbps_cmpver(argv[1], argv[2]);
374-
xbps_verbose_printf("%s %s %s\n",
375-
argv[1],
376-
(rv == 1) ? ">" : ((rv == 0) ? "=" : "<"),
377-
argv[2]);
377+
if (flags & XBPS_FLAG_VERBOSE) {
378+
fprintf(stderr, "%s %s %s\n",
379+
argv[1],
380+
(rv == 1) ? ">" : ((rv == 0) ? "=" : "<"),
381+
argv[2]);
382+
}
378383
exit(rv);
379384
} else if (strcmp(argv[0], "arch") == 0) {
380385
/* returns the xbps native arch */

0 commit comments

Comments
 (0)