nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 28d993a8e85651e6e8a61b410472febc6069ceb0
parent 22aa1455a6081ace0e1b1c09435a447296f914bf
Author: Martin Ziemer <gituser@horrad.de>
Date:   Thu,  4 Apr 2024 15:33:14 +0200

Fix file creation on OpenBSD

On OpenBSD at least one of O_RDONLY, O_WRONLY or O_RDWR is needed to open a file.

In creating a new file none of those is set, which leads to an EINVAL error ("invalid argument").

Since the new file is only created and never read, I chose to use O_WRONLY.

Diffstat:
Msrc/nnn.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -4732,7 +4732,7 @@ next: return FALSE; } } else { - int fd = open(path, O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); /* Forced create mode for files */ + int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); /* Forced create mode for files */ if (fd == -1 && errno != EEXIST) { DPRINTF_S("open!");