[LibOS/test/fs] Remove invalid mmap on file opened write-only

This commit is contained in:
borysp
2020-04-20 11:18:24 -07:00
committed by Dmitrii Kuvaiskii
parent cd1648bcd8
commit 63cdcd33e4
2 changed files with 14 additions and 3 deletions
+7 -2
View File
@@ -1,7 +1,10 @@
copy_execs = \
copy_mmap_execs = \
copy_mmap_rev \
copy_mmap_seq \
copy_mmap_whole \
copy_mmap_whole
copy_execs = \
$(copy_mmap_execs) \
copy_rev \
copy_seq \
copy_whole
@@ -39,6 +42,8 @@ $(execs): common.o
$(copy_execs): common_copy.o
$(copy_mmap_execs): CFLAGS += -DCOPY_MMAP
%.o: %.c
$(call cmd,cc_o_c)
+7 -1
View File
@@ -1,5 +1,11 @@
#include "common.h"
#ifdef COPY_MMAP
#define RDWR_OUTPUT_OPEN true
#else
#define RDWR_OUTPUT_OPEN false
#endif
void copy_file(const char* input_path, const char* output_path, size_t size) {
int fi = open_input_fd(input_path);
printf("open(%zu) input OK\n", size);
@@ -11,7 +17,7 @@ void copy_file(const char* input_path, const char* output_path, size_t size) {
fatal_error("Size mismatch: expected %zu, got %zu\n", size, st.st_size);
printf("fstat(%zu) input OK\n", size);
int fo = open_output_fd(output_path, /*rdwr=*/false);
int fo = open_output_fd(output_path, /*rdwr=*/RDWR_OUTPUT_OPEN);
printf("open(%zu) output OK\n", size);
if (fstat(fo, &st) < 0)