[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:1221]openp function with remote file.



# 妙なSubjectですが...。^_^;;

 ソースを眺めていて気付いたのですが、Meadow-1.04a1でスクリプト
ファイルの為に実行ファイルを検出する際の処理が変更された点について、
openpのコメントには、

>  If the file we find is remote, return 0
>  but store the found remote file name in *STOREPTR.
>  We do not check for remote files if EXEC_ONLY is nonzero.  */

とありますので、return 0 の場合はcloseするのは不味いのではないでしょうか?
他の個所では0の場合はcloseしない様です。

# 実行ファイルがremoteということは無いとおもいますが念の為。

簡単ですがpatchも付けます。
patchにはw32.cの同様の部分も含んでます。

-- 
椿本 浩也 (Hiroya Tsubakimoto)
Office: <zorac@xxxxxxxxxxxx> 有限会社シセン堂
Home: <zorac@xxxxxxxxxxxxxxxxxxxxx>


--- callproc.c.orig	Wed Jun 30 11:45:30 1999
+++ callproc.c	Wed Jun 30 11:45:02 1999
@@ -399,7 +399,10 @@
 #else
     /* for script execution on MSWindows, not apply exec_only for openp */
     /* openp without exec_only returns fd not used, free it immediately */
-    close(openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 0));
+    {
+      int fd = openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 0);
+      if (fd > 0) close(fd);
+    }
 #endif
     UNGCPRO;
   }
--- process.c.orig	Wed Jun 30 11:33:46 1999
+++ process.c	Wed Jun 30 11:34:58 1999
@@ -1167,7 +1167,10 @@
 #else
       /* for script execution on Windows, not apply exec_only for openp */
       /* openp without exec_only returns fd not used, free it immediately */
-      close(openp (Vexec_path, program, EXEC_SUFFIXES, &tem, 0));
+      {
+	int fd = openp (Vexec_path, program, EXEC_SUFFIXES, &tem, 0);
+	if (fd > 0) close(fd);
+      }
 #endif
       UNGCPRO;
       if (NILP (tem))
--- w32.c.orig	Wed Jun 30 11:38:02 1999
+++ w32.c	Wed Jun 30 11:38:10 1999
@@ -3441,7 +3441,7 @@
 #undef abort
 	  abort ();
 	}
-      else
+      else if (fd > 0)
 	{
 	  close (fd);
 	}