summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-18 06:59:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-18 06:59:36 +0000
commit58dd5de9664c57d72b45fd90a75f08fab506f208 (patch)
treed52f98f238f430e1ffbc6f6dbaba1e21b13db04c
parentbc5ff99474cc1ca67c14471b8c95244542740ef8 (diff)
2000-02-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--missing/file.h11
-rw-r--r--win32/win32.c15
-rw-r--r--win32/win32.h5
4 files changed, 28 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f5f5c49d07..f022c58abb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Feb 17 19:09:05 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (mypopen): don't close handle if it is not assigned.
+ * win32/win32.c (my_open_osfhandle): support O_NOINHERIT flag.
+ * win32/win32.c (win32_getcwd): rename getcwd to win32_getcwd
+ in order to avoid using the C/C++ runtime DLL's getcwd.
+ Use CharNext() to process directory name.
+ * win32/win32.h: map getcwd to win32_getcwd.
+
Wed Feb 16 00:32:49 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (method_arity): nd_rest is -1 for no rest argument.
diff --git a/missing/file.h b/missing/file.h
index b6cec8eb05..2d491d0fc1 100644
--- a/missing/file.h
+++ b/missing/file.h
@@ -12,12 +12,11 @@
# define L_XTND 2 /* seek from end. */
#endif
-# ifndef R_OK
-# define R_OK 4 /* test whether readable. */
-# define W_OK 2 /* test whether writable. */
-# define X_OK 1 /* test whether execubale. */
-# define F_OK 0 /* test whether exist. */
-# endif
+#ifndef R_OK
+# define R_OK 4 /* test whether readable. */
+# define W_OK 2 /* test whether writable. */
+# define X_OK 1 /* test whether execubale. */
+# define F_OK 0 /* test whether exist. */
#endif
#endif
diff --git a/win32/win32.c b/win32/win32.c
index 877978db58..a1e6d25ff3 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -546,15 +546,14 @@ mypopen (char *cmd, char *mode)
if (lpCmd2)
free(lpCmd2);
- CloseHandle(aProcessInformation.hThread);
-
if (!fRet) {
CloseHandle(hInFile);
CloseHandle(hOutFile);
- CloseHandle(aProcessInformation.hProcess);
return NULL;
}
+ CloseHandle(aProcessInformation.hThread);
+
if (reading) {
fd = _open_osfhandle((long)hInFile, (_O_RDONLY | pipemode));
CloseHandle(hOutFile);
@@ -1541,7 +1540,7 @@ typedef struct {
#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */
} ioinfo;
-EXTERN_C ioinfo * __pioinfo[];
+EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#define IOINFO_L2E 5
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
@@ -1549,6 +1548,7 @@ EXTERN_C ioinfo * __pioinfo[];
#define _osfile(i) (_pioinfo(i)->osfile)
#define FOPEN 0x01 /* file handle open */
+#define FNOINHERIT 0x10 /* file handle opened O_NOINHERIT */
#define FAPPEND 0x20 /* file handle opened O_APPEND */
#define FDEV 0x40 /* file handle refers to device */
#define FTEXT 0x80 /* file handle is in text mode */
@@ -1568,6 +1568,9 @@ my_open_osfhandle(long osfhandle, int flags)
if (flags & O_TEXT)
fileflags |= FTEXT;
+ if (flags & O_NOINHERIT)
+ fileflags |= FNOINHERIT;
+
/* attempt to allocate a C Runtime file handle */
if ((fh = _alloc_osfhnd()) == -1) {
errno = EMFILE; /* too many open files */
@@ -2203,7 +2206,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
}
char *
-getcwd(buffer, size)
+win32_getcwd(buffer, size)
char *buffer;
int size;
{
@@ -2218,7 +2221,7 @@ getcwd(buffer, size)
return NULL;
}
- for (bp = buffer; *bp != '\0'; bp++) {
+ for (bp = buffer; *bp != '\0'; bp = CharNext(bp)) {
if (*bp == '\\') {
*bp = '/';
}
diff --git a/win32/win32.h b/win32/win32.h
index a55641eada..cbcf4e8117 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -387,6 +387,11 @@ extern char *mystrerror(int);
#endif
#define get_osfhandle myget_osfhandle
+#ifdef getcwd
+#undef getcwd
+#endif
+#define getcwd win32_getcwd
+
#ifdef getenv
#undef getenv
#endif