[EMAIL PROTECTED] wrote:

> entry->h_aliases should be a nul terminated array of alternative names for
> your host - so that line shouldn't be causing a segfault.
> Can you look at the values of entry, entry->h_aliases, successive values of
> entry->h_aliases[...] and i to see if they are sane?
> Does the nshost test in base/Testing crash as well?
>

the base/Testing stuff also crashes. I've now added some NSLog's in the NSHost.m
to see how everything's done.. I discovered a crazy thing, the app really does
crash at the assignment (after a couple of loops which seem to run well). Here's
the output:  (the aliases are correct: localhost and neonhost)

---------------------------------------------------------------
Now we're entering _initWithHostEntry..
 Now we're entering _initWithHostEntry..
   Now we're entering that crashing while loop..
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[1]: "localhost"
       Now lets add it to "names"..
     Done!
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[2]: "neonhost"
       Now lets add it to "names"..
     Done!
   Now we're entering that crashing while loop..
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[1]: "localhost"
       Now lets add it to "names"..
     Done!
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[2]: "neonhost"
       Now lets add it to "names"..
     Done!
 Now we're entering _initWithHostEntry..
   Now we're entering that crashing while loop..
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[1]: "localhost"
       Now lets add it to "names"..
     Done!
     First of all, read the ptr to my own NSString (just for the debug
purpose)..
       h_aliases[2]: "neonhost"
       Now lets add it to "names"..
     Done!
 Now we're entering _initWithHostEntry..
   Now we're entering that crashing while loop..
Segmenteringsfel (core dumped)
------------------------------------------------------------

Here's the code:

i = 0;
NSLog(@"  Now we're entering that crashing while loop..");
while ((ptr = entry->h_aliases[i++]) != 0)
 {
   NSLog(@"    First of all, read the ptr to my own NSString (just for the debug
purpose)..");
   val=[NSString stringWithCString: ptr];
   num=[NSString stringWithFormat: @"%d",i ];
   NSLog(@"      h_aliases[%@]: \"%@\"",num,val);
   NSLog(@"      Now lets add it to \"names\"..");
   [names addObject: [NSString stringWithCString: ptr]];
   NSLog(@"    Done!");
 }


Reply via email to