Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3EFA8A17.5FB7E72F@dessent.net> Date: Wed, 25 Jun 2003 22:52:23 -0700 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,pdf MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: assertion "ptr != MAP_FAILED" failed while using mmap References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Alex Vinokur wrote: > char* ptr = (char*)mmap(0, sz, PROT_READ, 0, fd, 0); > > errno = 0; > if (ptr != MAP_FAILED) > { > string str(ptr, ptr+sz); > munmap(ptr, sz); > } > else > { > assert (ptr == MAP_FAILED); > printf ("=== Error : %u %s ===\n", errno, strerror (errno)); > } > The program prints: > === Error : 0 No error === Of course it does, since you set errno = 0, what else could you possibly expect? Remove that line if you want to know why mmap() fails. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/