bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLog() / NSLogv() annoyance


From: Adam Fedor
Subject: Re: NSLog() / NSLogv() annoyance
Date: 30 Jul 2003 21:47:29 -0600

On Mon, 2003-07-14 at 11:54, Chris B. Vetter wrote:
> Hi,
> 
> using NSLog() results in some nastiness:
> 
>   int main(int argc, char * const * argv)
>   {
>     errno = 0;
>     
>     fprintf(stderr, "1 errno=%d, %s\n", errno, strerror(errno));
>     {
>       NSLog(@"foobar");
>     }
>     fprintf(stderr, "2 errno=%d, %s\n", errno, strerror(errno));
>   }
> 
>   :0> gmake && ./shared_obj/test
>   1 errno=0, Undefined error: 0
>   2003-07-14 10:46:59.841 test[29673] foobar
>   2 errno=2, No such file or directory
> 
> Can't figure out where errno is set to 2, though I suspect it's coming
> from _NSLog_standard_printf_handler() trying to write to syslog(?).

I traced this down (and down, etc) - it actually happens when NSLog gets
a user default, and NSUserDefaults gets set up and looks for .GNUsteprc,
eventually getting to:

+[GSAttrDictionary attributesAt: traverseLink:]

which does a 'stat' on the file which doesn't exist. Anyway, what should
GNUstep do in this case? Reset errno to 0? The documentation says the
value isn't significant unless a library function returns an error, so
it really is undefined in this case.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]