mirror of
https://github.com/jarun/nnn.git
synced 2025-01-15 13:26:37 +00:00
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.
This commit is contained in:
parent
22aa1455a6
commit
28d993a8e8
|
@ -4732,7 +4732,7 @@ next:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if (fd == -1 && errno != EEXIST) {
|
||||||
DPRINTF_S("open!");
|
DPRINTF_S("open!");
|
||||||
|
|
Loading…
Reference in a new issue