From 76b2313b25e2fd33a508f63137d5113e1ca85150 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 19 Jun 2021 03:49:11 -0400 Subject: common: fs: Amend IsFile check in FileOpen / (Write/Append)StringToFile This check was preventing files with the Write or Append file access modes from being created, as per the documented behavior in FileAccessMode. This amends the check to test for the existence of a filesystem object prior to checking whether it is a regular file. Thanks to liushuyu for pointing out that removing the check altogether would not guard against attempting to open non-regular files such as directories, symlinks, FIFO (pipes), sockets, block devices, or character devices. The documentation has also been updated for these functions to clarify that a file refers to a regular file. --- src/common/fs/fs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/fs/fs.h') diff --git a/src/common/fs/fs.h b/src/common/fs/fs.h index cf7dfffcc..a6c993962 100644 --- a/src/common/fs/fs.h +++ b/src/common/fs/fs.h @@ -110,8 +110,8 @@ template * * Failures occur when: * - Input path is not valid - * - Filesystem object at path is not a file - * - The file is not opened + * - Filesystem object at path exists and is not a regular file + * - The file is not open * * @param path Filesystem path * @param mode File access mode -- cgit v1.2.3