pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41970?usp=email )
Change subject: logging_file: Avoid reopening file for stderr ......................................................................
logging_file: Avoid reopening file for stderr
target->tgt_file.fname is NULL for stderr log target.
Change-Id: I4a551b0c434c480e78852a0a4873700eac2f5853 --- M src/core/logging_file.c 1 file changed, 3 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/core/logging_file.c b/src/core/logging_file.c index a9a1cb7..6e01c26 100644 --- a/src/core/logging_file.c +++ b/src/core/logging_file.c @@ -55,6 +55,9 @@ OSMO_ASSERT(target->type == LOG_TGT_TYPE_FILE || target->type == LOG_TGT_TYPE_STDERR); OSMO_ASSERT(target->tgt_file.out || target->tgt_file.wqueue);
+ if (target->type == LOG_TGT_TYPE_STDERR) + return -ENOTSUP; + if (target->tgt_file.out) { fclose(target->tgt_file.out); target->tgt_file.out = fopen(target->tgt_file.fname, "a");