X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fwin32.c;h=924ee92a7ea90aede7b87899c5648b94680add22;hb=16b7a9a47be196cb33bf757faad24e73ceffc2fc;hp=e4e553c36ed67e5e1b3f16eef47d837a6f13d5cb;hpb=e601c439adce167078ac7b49550c0418ace86f94;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/win32.c b/win32/win32.c index e4e553c..924ee92 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -581,7 +581,6 @@ do_aspawn(void *vreally, void **vmark, void **vsp) } else { if (status < 0) { - dTHR; if (ckWARN(WARN_EXEC)) Perl_warner(aTHX_ WARN_EXEC, "Can't spawn \"%s\": %s", argv[0], strerror(errno)); status = 255 * 256; @@ -674,7 +673,6 @@ do_spawn2(char *cmd, int exectype) } else { if (status < 0) { - dTHR; if (ckWARN(WARN_EXEC)) Perl_warner(aTHX_ WARN_EXEC, "Can't %s \"%s\": %s", (exectype == EXECF_EXEC ? "exec" : "spawn"), @@ -977,31 +975,31 @@ chown(const char *path, uid_t owner, gid_t group) return 0; } -/* - * XXX this needs strengthening (for PerlIO) - * -- BKS, 11-11-200 -*/ -int mkstemp(const char *path) -{ - dTHX; - char buf[MAX_PATH+1]; - int i = 0, fd = -1; - -retry: - if (i++ > 10) { /* give up */ - errno = ENOENT; - return -1; - } - if (!GetTempFileNameA((LPCSTR)path, "plr", 1, buf)) { - errno = ENOENT; - return -1; - } - fd = PerlLIO_open3(buf, O_CREAT|O_RDWR|O_EXCL, 0600); - if (fd == -1) - goto retry; - return fd; -} - +/* + * XXX this needs strengthening (for PerlIO) + * -- BKS, 11-11-200 +*/ +int mkstemp(const char *path) +{ + dTHX; + char buf[MAX_PATH+1]; + int i = 0, fd = -1; + +retry: + if (i++ > 10) { /* give up */ + errno = ENOENT; + return -1; + } + if (!GetTempFileNameA((LPCSTR)path, "plr", 1, buf)) { + errno = ENOENT; + return -1; + } + fd = PerlLIO_open3(buf, O_CREAT|O_RDWR|O_EXCL, 0600); + if (fd == -1) + goto retry; + return fd; +} + static long find_pid(int pid) { @@ -1875,7 +1873,6 @@ win32_crypt(const char *txt, const char *salt) { dTHXo; #ifdef HAVE_DES_FCRYPT - dTHR; return des_fcrypt(txt, salt, w32_crypt_buffer); #else Perl_croak(aTHX_ "The crypt() function is unimplemented due to excessive paranoia."); @@ -2353,7 +2350,7 @@ win32_fstat(int fd,struct stat *sbufptr) } return rc; #else - return fstat(fd,sbufptr); + return my_fstat(fd,sbufptr); #endif } @@ -2365,11 +2362,11 @@ win32_pipe(int *pfd, unsigned int size, int mode) /* * a popen() clone that respects PERL5SHELL - * - * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000 + * + * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000 */ -DllExport PerlIO* +DllExport PerlIO* win32_popen(const char *command, const char *mode) { #ifdef USE_RTL_POPEN @@ -2443,11 +2440,7 @@ win32_popen(const char *command, const char *mode) } /* we have an fd, return a file stream */ -#ifdef USE_PERLIO - return (PerlIO_fdopen(p[parent], (char *)mode)); -#else - return (fdopen(p[parent], (char *)mode)); -#endif + return (PerlIO_fdopen(p[parent], (char *)mode)); cleanup: /* we don't need to check for errors here */ @@ -2467,7 +2460,7 @@ cleanup: */ DllExport int -win32_pclose(PerlIO *pf) +win32_pclose(PerlIO *pf) { #ifdef USE_RTL_POPEN return _pclose(pf); @@ -2477,7 +2470,7 @@ win32_pclose(PerlIO *pf) SV *sv; LOCK_FDPID_MUTEX; - sv = *av_fetch(w32_fdpid, PerlIO_fileno(pf), TRUE); + sv = *av_fetch(w32_fdpid, PerlIO_fileno(pf), TRUE); if (SvIOK(sv)) childpid = SvIVX(sv); @@ -2489,11 +2482,11 @@ win32_pclose(PerlIO *pf) return -1; } -#ifdef USE_PERLIO - PerlIO_close(pf); -#else - fclose(pf); -#endif +#ifdef USE_PERLIO + PerlIO_close(pf); +#else + fclose(pf); +#endif SvIVX(sv) = 0; UNLOCK_FDPID_MUTEX; @@ -2755,13 +2748,13 @@ win32_open(const char *path, int flag, ...) return open(PerlDir_mapA(path), flag, pmode); } -/* close() that understands socket */ -extern int my_close(int); /* in win32sck.c */ - +/* close() that understands socket */ +extern int my_close(int); /* in win32sck.c */ + DllExport int win32_close(int fd) { - return my_close(fd); + return my_close(fd); } DllExport int