PUBLIC_FN int write_file(char *path, char *buf, ssize_t len, int open_flags) {
if (len == -1) len = strlen(buf);
- int fd = open(path, open_flags|O_CLOEXEC, 0777);
+ int fd = open(path, open_flags|O_CLOEXEC|O_WRONLY, 0777);
if (fd == -1) return 1;
ssize_t write_res = write_nointr(fd, buf, len, NULL);
int write_errno = errno;