At 16:50 +0100 2003.11.19, Rafael Garcia-Suarez wrote:
>Chris Nandor wrote:
>>
>> At 16:39 +0100 2003.11.19, Rafael Garcia-Suarez wrote:
>> >What does
>> >    perl -le 'print $!=22'
>> >on your system ?
>>
>> 22.
>
>Hmm, weird -- on my Linux 2.2 it prints correctly "Invalid argument".
>I wanted to know what was this errno corresponding to.

Ah.

[EMAIL PROTECTED] pudge]$ perl -le 'print $!=22'
Invalid argument


>Try this naive patch :
>
>--- mg.c.orig  Wed Nov 19 16:41:47 2003
>+++ mg.c       Wed Nov 19 16:44:14 2003
>@@ -623,8 +623,12 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
>                 SetLastError(dwErr);
>            }
> #else
>-           sv_setnv(sv, (NV)errno);
>-           sv_setpv(sv, errno ? Strerror(errno) : "");
>+           {
>+               int saveerrno = errno;
>+               sv_setnv(sv, (NV)errno);
>+               sv_setpv(sv, errno ? Strerror(errno) : "");
>+               errno = saveerrno;
>+           }
> #endif
> #endif
> #endif

Heh, when I do that, I get:

$ perl -le '$^E=-1728; print $^E+0 for 0,1'
22
22

So I don't even get the correct value the *first* time.  :)

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to