From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5547 invoked by alias); 26 Jun 2003 05:53:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 4838 invoked from network); 26 Jun 2003 05:52:33 -0000 Received: from unknown (HELO booch.minidns.net) (67.160.219.187) by sources.redhat.com with SMTP; 26 Jun 2003 05:52:33 -0000 Received: from [127.0.0.1] (helo=dessent.net) by booch.minidns.net with esmtp (Exim 4.20) id HH2QZK-0002Q4-4O for cygwin@cygwin.com; Wed, 25 Jun 2003 22:52:32 -0700 Message-ID: <3EFA8A17.5FB7E72F@dessent.net> Date: Thu, 26 Jun 2003 09:23:00 -0000 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,pdf MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: assertion "ptr != MAP_FAILED" failed while using mmap References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-06/txt/msg01204.txt.bz2 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/