if (strcmp(path, "-") == 0)
fd = STDOUT_FILENO;
else
- fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
+ fd = open(path, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0644);
if (fd < 0)
return -errno;
if (to_stdout) {
fd = STDOUT_FILENO;
} else {
- fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
+ fd = open(path, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0644);
if (fd < 0) {
return -errno;
}