]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Correctly handle open() return value
authorNick Porter <nick@portercomputing.co.uk>
Fri, 5 Apr 2024 11:22:18 +0000 (12:22 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Fri, 5 Apr 2024 12:54:16 +0000 (13:54 +0100)
src/lib/unlang/xlat_builtin.c

index dda1b833923609bb43a79c227883df30b3cc484f..f36cad500479e0ff09415cb6098c6b1a947b1a7c 100644 (file)
@@ -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;