That's cleaner !

For info on the thread, Steve's pointer to

Perl_win32_init(): see win32/win32.c.

gives a much better way of determining if you have a compiler that automates manifests etc as well as having many different CRT features. i.e.

#if _MSC_VER >= 1400 && defined(_WRITE_ABORT_MSG)

Code not needed in boot.c now but I've seen so many nastier ways of doing this that I thought it was worth repeating the above here.

I'll post shortly on general progress with pp + windows

Mark


On 22/07/2011 09:28, Roderich Schupp wrote:
On Fri, Jul 22, 2011 at 9:48 AM, Mark Dootson<mark.doot...@znix.com>  wrote:
So, the int / file descriptor we pass to close() is being interpreted as
invalid.

Got it: the code for the first file written from boot.c does a second
close() on an
already closed file descriptor:


     i = my_mkfile( argv[0],
                    stmpdir, par_basename(par_findprog(argv[0],
strdup(par_getenv("PATH")))),
                    size_load_my_par,&my_perl );
     if ( !i ) return 2;
     if ( i != -2 ) {
         if (write_chunks(chunks_load_my_par, i) || close(i))
             return 2;
         close(i);<------------
delete this line
         chmod(my_perl, 0755);

write_chunks(...) returns 0 on success, so next expression in || will
be evaluated.
close(i) (first call) succeeds, i.e. returns 0, hence if condition is
not satisfied
and we proceed to call close(i) again.... This code is horribly warped.


Cheers, Roderich

Reply via email to