X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=wince%2Fwin32io.c;h=857f25be131aa57c3458dd26e1dbc4eadaa58c54;hb=0f133d1fd189cd7868dcc2bc811ba6499a1e9fd2;hp=22a142749b6f310ff2ed691c654ab2ec3f7b5d0a;hpb=aebd5ec7dc06344c5afdd73f107cf8809e9e60e1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/wince/win32io.c b/wince/win32io.c index 22a1427..857f25b 100644 --- a/wince/win32io.c +++ b/wince/win32io.c @@ -290,13 +290,19 @@ PerlIOWin32_close(pTHX_ PerlIO *f) PerlIOWin32 *s = PerlIOSelf(f,PerlIOWin32); if (s->refcnt == 1) { - if (CloseHandle(s->h)) + IV code = 0; +#if 0 + /* This does not do pipes etc. correctly */ + if (!CloseHandle(s->h)) { s->h = INVALID_HANDLE_VALUE; return -1; } +#else + PerlIOBase(f)->flags &= ~PERLIO_F_OPEN; + return win32_close(s->fd); +#endif } - PerlIOBase(f)->flags &= ~PERLIO_F_OPEN; return 0; } @@ -305,16 +311,15 @@ PerlIOWin32_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *params, int flags) { PerlIOWin32 *os = PerlIOSelf(f,PerlIOWin32); HANDLE proc = GetCurrentProcess(); - HANDLE new; -//vvv todo if (DuplicateHandle(proc, os->h, proc, &new, 0, FALSE, DUPLICATE_SAME_ACCESS)) - if (0) + HANDLE new; + if (DuplicateHandle(proc, os->h, proc, &new, 0, FALSE, DUPLICATE_SAME_ACCESS)) { char mode[8]; int fd = win32_open_osfhandle((intptr_t) new, PerlIOUnix_oflags(PerlIO_modestr(o,mode))); - if (fd >= 0) + if (fd >= 0) { f = PerlIOBase_dup(aTHX_ f, o, params, flags); - if (f) + if (f) { PerlIOWin32 *fs = PerlIOSelf(f,PerlIOWin32); fs->h = new; @@ -338,12 +343,14 @@ PerlIOWin32_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *params, int flags) } PerlIO_funcs PerlIO_win32 = { + sizeof(PerlIO_funcs), "win32", sizeof(PerlIOWin32), PERLIO_K_RAW, PerlIOWin32_pushed, PerlIOWin32_popped, PerlIOWin32_open, + PerlIOBase_binmode, NULL, /* getarg */ PerlIOWin32_fileno, PerlIOWin32_dup, @@ -366,5 +373,5 @@ PerlIO_funcs PerlIO_win32 = { NULL, /* set_ptrcnt */ }; - #endif +