From: Arran Cudbard-Bell Date: Thu, 27 Mar 2025 00:49:07 +0000 (-0600) Subject: Remember if we opened the fp referring to the file we're processing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d6be5cd097c7d08a84ca6a020dc5cb9a728003c;p=thirdparty%2Ffreeradius-server.git Remember if we opened the fp referring to the file we're processing Mostly to quiet clang analyzer --- diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index 3ebac5f0f8c..30e36efd657 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -3439,6 +3439,7 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const ssize_t data_used = 0; /* How much data the last command wrote */ static char path[PATH_MAX] = ""; command_line_range_t *lr = NULL; + bool opened_fp = false; command_file_ctx_t *cc; @@ -3465,6 +3466,7 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const } filename = path; + opened_fp = true; } if (lines && !fr_dlist_empty(lines)) lr = fr_dlist_head(lines); @@ -3578,7 +3580,8 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const } finish: - if (fp && (fp != stdin)) fclose(fp); + /* The explicit check is to quiet clang_analyzer */ + if (opened_fp) fclose(fp); /* * Free any residual resources we loaded.