Fix rz-find ignoring RZ_LOGLEVEL. (#5592)

This commit is contained in:
Muhammed Answar C K 2025-12-10 12:21:06 +05:30 committed by GitHub
parent 67f301eb54
commit 61f06f07ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2009-2020 pancake <pancake@nopcode.org>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_util/rz_log.h>
#include <rz_util/rz_str.h>
#include <stdio.h>
#include <stdlib.h>
@ -515,6 +517,16 @@ RZ_API int rz_main_rz_find(int argc, const char **argv) {
int c;
const char *file = NULL;
int n = RZ_DEFAULT_LOGLVL;
char *log_level = rz_sys_getenv("RZ_LOGLEVEL");
if (RZ_STR_ISNOTEMPTY(log_level)) {
n = atoi(log_level);
free(log_level);
}
if (n >= 0 && n < RZ_LOGLVL_SIZE) {
rz_log_set_level((RzLogLevel)n);
}
RzGetopt opt;
rz_getopt_init(&opt, argc, argv, "a:ie:b:jmM:s:w:S:I:x:Xzf:F:t:E:rqnhvZ");
while ((c = rz_getopt_next(&opt)) != -1) {