Re: strdup or str_dup?

From: Acido (
Date: 03/10/99

At 08:48 PM 3/9/99 -0800, you wrote:
>Acido wrote:
>> Uhm so i get the idea it's a pretty bad thing if it dosn't crash in
>> most cases. So how do i make sure that it DO crash and dump core
>> acordingly??
>Well, it should already.  I don't have the code at hand, but it should
>call "strlen()" to determine the number of bytes to allocate for the
>new string.  strlen() should crash on NULL.  Although, unfortunately
>and oddly enough, some platforms don't crash when they should, or
>do crash when they shouldn't.
>I remember working for a MUD that was running on Solaris a few years
>back -- I wrote up some code that I had tested on Linux and BSD for
>inline colors.  It worked fine on both.  But on Solaris, the MUD
>crashed whenever a message was sent.  I agonized over it for a while,
>then -- on a whim -- I changed all the "*str = 0;" lines to
>"*str = '\0';" and it ran fine.  <sigh>

Uhm just wondering if passing a NULL string would crash
in redhat linux? of cause i could give it a try heh..
>> (we all know dak is always right all the time hehe :)
>Actually, I'm usually wrong.  But I hide it well.

Heh nah can't remember of a time you were wrong atm :)

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST