3.3p1 patch for Solaris 2.6

Jun-ichiro itojun Hagino itojun at iijlab.net
Wed Jun 26 00:52:53 EST 2002


	here's a patch to 3.3p1 for Solaris 2.6 - it does not handle
	mmap() with fd = -1.  does it look okay?

itojun


--- work.i386/openssh-3.3p1/servconf.c-	Tue Jun 25 23:43:22 2002
+++ work.i386/openssh-3.3p1/servconf.c	Tue Jun 25 23:43:33 2002
@@ -257,7 +257,7 @@
 	if (use_privsep == -1)
 		use_privsep = 1;
 
-#if !defined(HAVE_MMAP) || !defined(MAP_ANON)
+#if !defined(HAVE_MMAP)
 	if (use_privsep && options->compression == 1) {
 		error("This platform does not support both privilege "
 		    "separation and compression");
--- work.i386/openssh-3.3p1/monitor_mm.c-	Tue Jun 25 23:42:02 2002
+++ work.i386/openssh-3.3p1/monitor_mm.c	Tue Jun 25 23:43:11 2002
@@ -71,6 +71,9 @@
 {
 	void *address;
 	struct mm_master *mm;
+#if defined(HAVE_MMAP) && !defined(MAP_ANON)
+	int fd;
+#endif
 
 	if (mmalloc == NULL)
 		mm = xmalloc(sizeof(struct mm_master));
@@ -87,6 +90,13 @@
 #if  defined(HAVE_MMAP) && defined(MAP_ANON)
 	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
 	    -1, 0);
+	if (address == MAP_FAILED)
+		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
+#elif defined(HAVE_MMAP) && !defined(MAP_ANON)
+	fd = open("/dev/zero", O_RDWR);
+	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
+	    fd, 0);
+	close(fd);
 	if (address == MAP_FAILED)
 		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
 #else



More information about the openssh-unix-dev mailing list