From: Nick Porter Date: Fri, 5 Apr 2024 11:22:18 +0000 (+0100) Subject: Correctly handle open() return value X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94f52bb3ae0da547eb2fce02d333c7fde7532748;p=thirdparty%2Ffreeradius-server.git Correctly handle open() return value --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index dda1b833923..f36cad50047 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -1231,7 +1231,7 @@ static xlat_action_t xlat_func_log_dst(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor dbg->dst = L_DST_FILES; dbg->file = talloc_strdup(dbg, file->vb_strvalue); dbg->fd = open(dbg->file, O_WRONLY | O_CREAT | O_CLOEXEC, 0600); - if (!dbg->fd) { + if (dbg->fd < 0) { REDEBUG("Failed opening %s - %s", dbg->file, fr_syserror(errno)); talloc_free(dbg); return XLAT_ACTION_DONE;