summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 71097ea1ae..ff52692fec 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1132,6 +1132,7 @@ win32_stat(const char *path, struct stat *sbuf)
if (S_ISDIR(sbuf->st_mode))
sbuf->st_mode |= S_IWRITE | S_IEXEC;
else if (S_ISREG(sbuf->st_mode)) {
+ int perms;
if (l >= 4 && path[l-4] == '.') {
const char *e = path + l - 3;
if (strnicmp(e,"exe",3)
@@ -1144,6 +1145,9 @@ win32_stat(const char *path, struct stat *sbuf)
}
else
sbuf->st_mode &= ~S_IEXEC;
+ /* Propagate permissions to _group_ and _others_ */
+ perms = sbuf->st_mode & (S_IREAD|S_IWRITE|S_IEXEC);
+ sbuf->st_mode |= (perms>>3) | (perms>>6);
}
#endif
}
@@ -2709,7 +2713,12 @@ _fixed_read(int fh, void *buf, unsigned cnt)
return -1;
}
- EnterCriticalSection(&(_pioinfo(fh)->lock)); /* lock file */
+ /*
+ * If lockinitflag is FALSE, assume fd is device
+ * lockinitflag is set to TRUE by open.
+ */
+ if (_pioinfo(fh)->lockinitflag)
+ EnterCriticalSection(&(_pioinfo(fh)->lock)); /* lock file */
bytes_read = 0; /* nothing read yet */
buffer = (char*)buf;
@@ -2857,7 +2866,8 @@ _fixed_read(int fh, void *buf, unsigned cnt)
}
functionexit:
- LeaveCriticalSection(&(_pioinfo(fh)->lock)); /* unlock file */
+ if (_pioinfo(fh)->lockinitflag)
+ LeaveCriticalSection(&(_pioinfo(fh)->lock)); /* unlock file */
return bytes_read;
}
@@ -3119,6 +3129,7 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
int ret;
void* env;
char* dir;
+ child_IO_table tbl;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
DWORD create = 0;
@@ -3147,9 +3158,10 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
}
memset(&StartupInfo,0,sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
- StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ PerlEnv_get_child_IO(&tbl);
+ StartupInfo.hStdInput = tbl.childStdIn;
+ StartupInfo.hStdOutput = tbl.childStdOut;
+ StartupInfo.hStdError = tbl.childStdErr;
if (StartupInfo.hStdInput != INVALID_HANDLE_VALUE &&
StartupInfo.hStdOutput != INVALID_HANDLE_VALUE &&
StartupInfo.hStdError != INVALID_HANDLE_VALUE)
@@ -3960,6 +3972,15 @@ Perl_win32_init(int *argcp, char ***argvp)
MALLOC_INIT;
}
+void
+win32_get_child_IO(child_IO_table* ptbl)
+{
+ ptbl->childStdIn = GetStdHandle(STD_INPUT_HANDLE);
+ ptbl->childStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ ptbl->childStdErr = GetStdHandle(STD_ERROR_HANDLE);
+}
+
+
#ifdef USE_ITHREADS
# ifdef PERL_OBJECT