mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-04 21:01:40 +00:00
[LibOS/test/fs] Remove invalid mmap on file opened write-only
This commit is contained in:
committed by
Dmitrii Kuvaiskii
parent
cd1648bcd8
commit
63cdcd33e4
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user