Blame SOURCES/0010-Fix-crashes-when-using-the-touch-option.patch

57043d
From a47463a72864a76b0557468daf83741632ea4d72 Mon Sep 17 00:00:00 2001
57043d
From: Patrick Mansfield <patrick.mansfield@cpacketnetworks.com>
57043d
Date: Mon, 30 Sep 2019 15:59:53 -0700
57043d
Subject: [PATCH] Fix crashes when using the "--touch" option.
57043d
57043d
Fix memory to be mapped read/write, so that the "touch" option can write to it.
57043d
57043d
Signed-off-by: Patrick Mansfield <patrick.mansfield@cpacketnetworks.com>
57043d
---
57043d
 shm.c | 6 +++---
57043d
 1 file changed, 3 insertions(+), 3 deletions(-)
57043d
57043d
diff --git a/shm.c b/shm.c
57043d
index 260eeff..fb592ed 100644
57043d
--- a/shm.c
57043d
+++ b/shm.c
57043d
@@ -119,7 +119,7 @@ void attach_sysvshm(char *name, char *opt)
57043d
 		shmlen = s.shm_segsz;
57043d
 	}
57043d
 
57043d
-	shmptr = shmat(shmfd, NULL, SHM_RDONLY);
57043d
+	shmptr = shmat(shmfd, NULL, 0);
57043d
 	if (shmptr == (void*)-1)
57043d
 		err("shmat");
57043d
 	shmptr += shmoffset;
57043d
@@ -134,7 +134,7 @@ void attach_shared(char *name, char *opt)
57043d
 {
57043d
 	struct stat64 st;
57043d
 
57043d
-	shmfd = open(name, O_RDONLY);
57043d
+	shmfd = open(name, O_RDWR);
57043d
 	if (shmfd < 0) {
57043d
 		errno = 0;
57043d
 		if (shmlen == 0)
57043d
@@ -160,7 +160,7 @@ void attach_shared(char *name, char *opt)
57043d
 
57043d
 	/* RED-PEN For shmlen > address space may need to map in pieces.
57043d
 	   Left for some poor 32bit soul. */
57043d
-	shmptr = mmap64(NULL, shmlen, PROT_READ, MAP_SHARED, shmfd, shmoffset);
57043d
+	shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset);
57043d
 	if (shmptr == (char*)-1)
57043d
 		err("shm mmap");
57043d
 
57043d
-- 
57043d
2.7.5
57043d