# a limited range should set this to `yes`.
#
escape_filenames = no
+
+ #
+ # fsync::
+ #
+ # Synchronise data written with the file system after every
+ # write, returning fail when the operation fails.
+ #
+ fsync = no
}
#
gid_t group; //!< Resolved gid.
exfile_t *ef; //!< Exclusive file access handle.
bool escape; //!< Do filename escaping, yes / no.
+ bool fsync; //!< fsync after each write.
} file;
struct {
{ FR_CONF_OFFSET("permissions", rlm_linelog_t, file.permissions), .dflt = "0600" },
{ FR_CONF_OFFSET("group", rlm_linelog_t, file.group_str) },
{ FR_CONF_OFFSET("escape_filenames", rlm_linelog_t, file.escape), .dflt = "no" },
+ { FR_CONF_OFFSET("fsync", rlm_linelog_t, file.fsync), .dflt = "no" },
CONF_PARSER_TERMINATOR
};
return -1;
}
+ if (inst->file.fsync && (fsync(fd) < 0)) {
+ RERROR("Failed syncing \"%pV\" to persistent storage: %s", call_env->filename, fr_syserror(errno));
+ exfile_close(inst->file.ef, fd);
+ return -1;
+ }
}
if (RDEBUG_ENABLED3) linelog_hexdump(request, vector_p, vector_len, "linelog data");