From 8e4075e6b1911679ae3da837b5f13fb85c8f01f5 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Thu, 30 Jul 2009 09:07:35 +0300 Subject: io: fix mmap writing to actually work apparently it needs to have both PROT_READ and PROT_WRITE. and it needs to be MAP_SHARED for the writing to be effective. oh, and the data needs to be preallocated with ftruncate; otherwise, one gets SIGBUS. --- src/archive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/archive.c') diff --git a/src/archive.c b/src/archive.c index dca99fd..31c0909 100644 --- a/src/archive.c +++ b/src/archive.c @@ -331,7 +331,7 @@ int apk_archive_entry_extract(const struct apk_file_info *ae, break; case S_IFREG: if (ae->link_target == NULL) { - fd = open(fn, O_WRONLY | O_CREAT, ae->mode & 07777); + fd = open(fn, O_RDWR | O_CREAT, ae->mode & 07777); if (fd < 0) { r = -1; break; -- cgit v1.2.3-70-g09d2