projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix log compression storage on windows
[fio.git]
/
iolog.c
diff --git
a/iolog.c
b/iolog.c
index 41d3e4735036a2a23c7aa157934f5188f39a03b7..aa9c3bb1e4eca43fa0cf1c9794df39656ba80972 100644
(file)
--- a/
iolog.c
+++ b/
iolog.c
@@
-1218,7
+1218,7
@@
int iolog_file_inflate(const char *file)
void *buf;
FILE *f;
void *buf;
FILE *f;
- f = fopen(file, "r");
+ f = fopen(file, "r
b
");
if (!f) {
perror("fopen");
return 1;
if (!f) {
perror("fopen");
return 1;
@@
-1300,10
+1300,21
@@
void flush_log(struct io_log *log, bool do_append)
void *buf;
FILE *f;
void *buf;
FILE *f;
+ /*
+ * If log_gz_store is true, we are writing a binary file.
+ * Set the mode appropriately (on all platforms) to avoid issues
+ * on windows (line-ending conversions, etc.)
+ */
if (!do_append)
if (!do_append)
- f = fopen(log->filename, "w");
+ if (log->log_gz_store)
+ f = fopen(log->filename, "wb");
+ else
+ f = fopen(log->filename, "w");
else
else
- f = fopen(log->filename, "a");
+ if (log->log_gz_store)
+ f = fopen(log->filename, "ab");
+ else
+ f = fopen(log->filename, "a");
if (!f) {
perror("fopen log");
return;
if (!f) {
perror("fopen log");
return;