[#8824] [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro)

ごとけんです

38 messages 2000/01/05
[#8839] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8842] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8843] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8844] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8846] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8847] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8893] Re: [ruby-list:20142] Re: Range expansion? — Akinori MUSHA aka knu <knu@...>

 knuです。ruby-listから舞台を移しました。

13 messages 2000/01/09

[#8980] 1.4.3 patch for near-future *BSD IPv6 support — Jun-ichiro itojun Hagino <itojun@...>

近い将来の{Net,Free,Open}BSDにはKAME IPv6 stackが統合されています。

17 messages 2000/01/20
[#8981] Re: 1.4.3 patch for near-future *BSD IPv6 support — Jun-ichiro itojun Hagino <itojun@...> 2000/01/20

> それから、

[ruby-dev:8859] [PATCH] 2000/1/5 1.5.0 commit

From: Katsuyuki Komatsu <komatsu@...>
Date: 2000-01-07 00:49:50 UTC
List: ruby-dev #8859
小松です。

同様に1.5.0分。
取り込み漏れ以外に、以下がありました。

    cygwin/GNUmakefile.in: パッチあての失敗?
    file.c: 1.4.3で入れてもらったfile.cの変更の1.5.0への反映漏れ

diff -rup ruby-1.5.0.dist/cygwin/GNUmakefile.in ruby-1.5.0/cygwin/GNUmakefile.in
--- ruby-1.5.0.dist/cygwin/GNUmakefile.in	Wed Jan  5 13:37:16 2000
+++ ruby-1.5.0/cygwin/GNUmakefile.in	Wed Jan  5 18:29:39 2000
@@ -4,5 +4,6 @@ RUBYCWDLL=rubycw.dll
 
 miniruby$(EXEEXT): $(RUBYCWDLL)
 
+$(RUBYCWDLL): $(OBJS) dmyext.o
 	$(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o
 	@NM@ --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h 
diff -rup ruby-1.5.0.dist/ext/socket/socket.c ruby-1.5.0/ext/socket/socket.c
--- ruby-1.5.0.dist/ext/socket/socket.c	Wed Jan  5 13:37:17 2000
+++ ruby-1.5.0/ext/socket/socket.c	Fri Jan  7 09:42:12 2000
@@ -92,10 +92,13 @@ static void
 sock_finalize(fptr)
     OpenFile *fptr;
 {
-    if (!fptr->f) return;
+    SOCKET s;
 
+    if (!fptr->f) return;
+    s = get_osfhandle(fileno(fptr->f));
     myfdclose(fptr->f);
-    if(fptr->f2) myfdclose(fptr->f2);
+    if (fptr->f2) myfdclose(fptr->f2);
+    closesocket(s);
 }
 #endif
 
diff -rup ruby-1.5.0.dist/file.c ruby-1.5.0/file.c
--- ruby-1.5.0.dist/file.c	Wed Jan  5 13:37:00 2000
+++ ruby-1.5.0/file.c	Wed Jan  5 13:37:00 2000
@@ -403,8 +403,8 @@ eaccess(path, mode)
   if (st.st_mode & mode) return 0;
 
   return -1;
-#else  /* !NT*/
-	return 0;
+#else  /* !NT */
+  return access(path, mode);
 #endif
 }
 
diff -rup ruby-1.5.0.dist/win32/win32.c ruby-1.5.0/win32/win32.c
--- ruby-1.5.0.dist/win32/win32.c	Wed Jan  5 13:37:27 2000
+++ ruby-1.5.0/win32/win32.c	Tue Dec 28 01:57:23 1999
@@ -229,7 +229,6 @@ char *getlogin()
 struct {
     int inuse;
     int pid;
-    HANDLE oshandle;
     FILE *pipe;
 } MyPopenRecord[MYPOPENSIZE];
 
@@ -509,23 +508,11 @@ mypopen (char *cmd, char *mode) 
 		sa.lpSecurityDescriptor = NULL;
 		sa.bInheritHandle       = TRUE;
 
-		if (!reading) {
-        	FILE *fp;
-
-			fp = (_popen)(cmd, mode);
-
-			MyPopenRecord[slot].inuse = TRUE;
-			MyPopenRecord[slot].pipe = fp;
-			MyPopenRecord[slot].pid = -1;
-
-			if (!fp)
-                        rb_fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
-				return fp;
-		}
-
 		fRet = CreatePipe(&hInFile, &hOutFile, &sa, 2048L);
-		if (!fRet)
-                        rb_fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
+		if (!fRet) {
+			errno = GetLastError();
+			rb_sys_fail("mypopen: CreatePipe");
+		}
 
 		memset(&aStartupInfo, 0, sizeof (STARTUPINFO));
 		memset(&aProcessInformation, 0, sizeof (PROCESS_INFORMATION));
@@ -547,46 +534,50 @@ mypopen (char *cmd, char *mode) 
 		lpCommandLine = cmd;
 		if (NtHasRedirection(cmd) || isInternalCmd(cmd)) {
 		  lpApplicationName = getenv("COMSPEC");
-		  lpCmd2 = malloc(strlen(lpApplicationName) + 1 + strlen(cmd) + sizeof (" /c "));
-		  if (lpCmd2 == NULL)
-                     rb_fatal("Mypopen: malloc failed");
+		  lpCmd2 = xmalloc(strlen(lpApplicationName) + 1 + strlen(cmd) + sizeof (" /c "));
 		  sprintf(lpCmd2, "%s %s%s", lpApplicationName, " /c ", cmd);
 		  lpCommandLine = lpCmd2;
 		}
 
 		fRet = CreateProcess(lpApplicationName, lpCommandLine, &sa, &sa,
 			sa.bInheritHandle, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation);
+		errno = GetLastError();
+
+		if (lpCmd2)
+			free(lpCmd2);
+
+		CloseHandle(aProcessInformation.hThread);
 
 		if (!fRet) {
 			CloseHandle(hInFile);
 			CloseHandle(hOutFile);
-                        rb_fatal("cannot fork for \"%s\" (%s)", cmd, strerror(errno));
+			CloseHandle(aProcessInformation.hProcess);
+			return NULL;
 		}
 
-		CloseHandle(aProcessInformation.hThread);
-
 		if (reading) {
 			fd = _open_osfhandle((long)hInFile,  (_O_RDONLY | pipemode));
 			CloseHandle(hOutFile);
 		}
 		else {
-		    fd = _open_osfhandle((long)hOutFile, (_O_WRONLY | pipemode));
+			fd = _open_osfhandle((long)hOutFile, (_O_WRONLY | pipemode));
 			CloseHandle(hInFile);
 		}
 
-		if (fd == -1) 
-                  rb_fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
-
-
-		if ((fp = (FILE *) fdopen(fd, mode)) == NULL)
-			return NULL;
+		if (fd == -1) {
+			CloseHandle(reading ? hInFile : hOutFile);
+			CloseHandle(aProcessInformation.hProcess);
+			rb_sys_fail("mypopen: _open_osfhandle");
+		}
 
-		if (lpCmd2)
-			free(lpCmd2);
+		if ((fp = (FILE *) fdopen(fd, mode)) == NULL) {
+			_close(fd);
+			CloseHandle(aProcessInformation.hProcess);
+			rb_sys_fail("mypopen: fdopen");
+		}
 
 		MyPopenRecord[slot].inuse = TRUE;
 		MyPopenRecord[slot].pipe  = fp;
-		MyPopenRecord[slot].oshandle = (reading ? hInFile : hOutFile);
 		MyPopenRecord[slot].pid   = (int)aProcessInformation.hProcess;
 		return fp;
     }
@@ -638,14 +629,13 @@ mypclose(FILE *fp)
 			}
 		}
 	}
+	CloseHandle((HANDLE)MyPopenRecord[i].pid);
 #endif
 
-
     //
     // close the pipe
     //
-    // Closehandle() is done by fclose().
-    //CloseHandle(MyPopenRecord[i].oshandle);
+
     fflush(fp);
     fclose(fp);
 
@@ -1629,7 +1619,8 @@ myfdopen (int fd, const char *mode)
 void
 myfdclose(FILE *fp)
 {
-	fclose(fp);
+    _free_osfhnd(fileno(fp));
+    fclose(fp);
 }
 
 

--
小松克行 / Katsuyuki Komatsu <komatsu@sarion.co.jp>

In This Thread

Prev Next