delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/05/12:25:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4AF30A85.5070208@users.sourceforge.net>
Date: Thu, 05 Nov 2009 11:25:25 -0600
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: malloc overrides
References: <4AF29EC2 DOT 2050808 AT users DOT sourceforge DOT net> <4AF2D091 DOT 4030508 AT gmail DOT com>
In-Reply-To: <4AF2D091.4030508@gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 05/11/2009 07:18, Dave Korn wrote:
>> extern void _exit (int);
>> extern char* strdup (const char*);
>
>    static int are_we_stuck = 1;
>>
>> char* malloc(unsigned n) {
>        are_we_stuck = 0;
>>      return 0;
>> }
>>
>> int main(void) {
>>      strdup("yo");
>        _exit (are_we_stuck);
>> }
>
>    FTFY.

Funny, as I went to sleep last night I thought of just that solution. 
In practice, though, while it doesn't hang, it doesn't give the correct 
answer either.   As Corinna said, the malloc override needs to be 
functional, in that it allocates memory which can then be free()d.  So 
this isn't going to be quite so simple. :-(


Yaakov

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019