Skip to content

Commit

Permalink
memtool: let mw create the target file if it doesn't exist
Browse files Browse the repository at this point in the history
Signed-off-by: Uwe Kleine-König <[email protected]>
  • Loading branch information
Uwe Kleine-König committed Oct 21, 2016
1 parent e7f2867 commit a36d06a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion memtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ static void *memmap(const char *file, off_t addr, size_t *size, int readonly)
if (pagesize < 0)
pagesize = 4096;

memfd = open(file, readonly ? O_RDONLY : O_RDWR);
memfd = open(file, readonly ? O_RDONLY : (O_RDWR | O_CREAT),
S_IRUSR | S_IWUSR);
if (memfd < 0) {
perror("open");
return NULL;
Expand Down

0 comments on commit a36d06a

Please sign in to comment.