projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
spv-writer: Consistently use label from output_item.
[pspp]
/
src
/
data
/
make-file.c
diff --git
a/src/data/make-file.c
b/src/data/make-file.c
index 62dfb71d3dcf366ddd37a515ab10a0dec54a48fa..a1a541a5d0fb81c6c8938050ce6c3339f1ab31d5 100644
(file)
--- a/
src/data/make-file.c
+++ b/
src/data/make-file.c
@@
-19,7
+19,6
@@
#include "data/make-file.h"
#include "libpspp/i18n.h"
#include "data/make-file.h"
#include "libpspp/i18n.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@
-266,7
+265,10
@@
replace_file_start (const struct file_handle *fh, const char *mode,
rf->tmp_name = convert_to_filename_encoding (rf->tmp_name_verbatim, strlen (rf->tmp_name_verbatim), fh_get_file_name_encoding (fh));
/* Create file by that name. */
rf->tmp_name = convert_to_filename_encoding (rf->tmp_name_verbatim, strlen (rf->tmp_name_verbatim), fh_get_file_name_encoding (fh));
/* Create file by that name. */
- fd = Topen (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, permissions);
+ bool binary = strchr (mode, 'b') != NULL;
+ fd = Topen (rf->tmp_name,
+ O_WRONLY | O_CREAT | O_EXCL | (binary ? O_BINARY : O_TEXT),
+ permissions);
if (fd >= 0)
break;
if (errno != EEXIST)
if (fd >= 0)
break;
if (errno != EEXIST)