Skip to content

Commit 0af2e06

Browse files
bchaliosclaude
andcommitted
fix(cache): use correct mmap-go constant for read-write mapping
mmap.MapRegion expects the library's own constants (mmap.RDWR), not raw unix PROT_* flags. Passing unix.PROT_READ|unix.PROT_WRITE (=3) happened to work due to numerical coincidence, but is fragile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
1 parent d354f78 commit 0af2e06

File tree

1 file changed

+1
-1
lines changed
  • packages/orchestrator/pkg/sandbox/block

1 file changed

+1
-1
lines changed

packages/orchestrator/pkg/sandbox/block/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewCache(size, blockSize int64, filePath string, dirtyFile bool) (*Cache, e
8585
return nil, fmt.Errorf("size too big: %d > %d", size, math.MaxInt)
8686
}
8787

88-
mm, err := mmap.MapRegion(f, int(size), unix.PROT_READ|unix.PROT_WRITE, 0, 0)
88+
mm, err := mmap.MapRegion(f, int(size), mmap.RDWR, 0, 0)
8989
if err != nil {
9090
return nil, fmt.Errorf("error mapping file: %w", err)
9191
}

0 commit comments

Comments
 (0)