diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2014-09-18 01:16:08 +0000 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2014-09-18 01:16:08 +0000 |
commit | cc94f989c49e4645796fb7dcc471ebb696606ffa (patch) | |
tree | 7a2c64ce10d5206c168d673bf5f1b3f44906bf16 | |
parent | 1244d523e3b59dbb8fab7320587f11a9333d33dd (diff) |
fix non persistent changes to file
when using MAP_PRIVATE with mmap(), the content is not updated in the
filesystem. Only the mapping is changed.
fixed by replacing MAP_PRIVATE by MAP_SHARED
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r-- | stegmp.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -152,7 +152,7 @@ static int stegmp(const char *bmp_file, FILE *input) fstat(fileno(fh), &stat); addr = mmap(NULL, stat.st_size, PROT_READ | ((input) ? PROT_WRITE : 0), - MAP_PRIVATE, fileno(fh), 0); + MAP_SHARED, fileno(fh), 0); if (addr == MAP_FAILED) { fprintf(stderr, "%s: %m\n", bmp_file); |