mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
os_open: add unit tests
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#include "nvim/misc2.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/log.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/fs.c.generated.h"
|
||||
@@ -156,16 +155,16 @@ static bool is_executable_in_path(const char_u *name)
|
||||
/// calls (read, write, lseek, fcntl, etc.). If the operation fails, `-errno`
|
||||
/// is returned, and no file is created or modified.
|
||||
///
|
||||
/// @param flags bitwise OR of flags defined in <fcntl.h>
|
||||
/// @param mode permissions for the newly-created file (IGNORED if 'flags' is
|
||||
/// not `O_CREAT` or `O_TMPFILE`)
|
||||
/// @param flags Bitwise OR of flags defined in <fcntl.h>
|
||||
/// @param mode Permissions for the newly-created file (IGNORED if 'flags' is
|
||||
/// not `O_CREAT` or `O_TMPFILE`), subject to the current umask
|
||||
/// @return file descriptor, or negative `errno` on failure
|
||||
int os_open(const char* path, int flags, int mode)
|
||||
{
|
||||
uv_fs_t open_req;
|
||||
int r = uv_fs_open(uv_default_loop(), &open_req, path, flags, mode, NULL);
|
||||
uv_fs_req_cleanup(&open_req);
|
||||
//`r` is the same as open_req.result, except when OOM. So just use `r`.
|
||||
// r is the same as open_req.result (except for OOM: then only r is set).
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user