CVS update by vins xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Wed May 9 08:36:29 EDT 2007


  User: vins    
  Date: 07/05/09 14:36:29

  Branch:      xemacs/src release-21-4
  Modified:    xemacs/src ChangeLog callproc.c dumper.c nt.c sysfile.h
Log:
On Windows, tie executable permission to read permission.
Don't close already-closed fds.

Revision  Changes    Path
1.290.2.120 +13 -0     XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.290.2.119
retrieving revision 1.290.2.120
diff -u -p -r1.290.2.119 -r1.290.2.120
--- ChangeLog	2007/02/10 01:35:21	1.290.2.119
+++ ChangeLog	2007/05/09 12:36:16	1.290.2.120
@@ -1,3 +1,16 @@
+2007-05-02  Vin Shelton  <acs at xemacs.org>
+
+	* dumper.c (pdump): Don't close pdump_fd (already closed by
+	fclose() call.  Patch from Steve Higham.
+	* callproc.c (Fold_call_process_internal): Don't close fd1 if it's
+	already closed.  Patch inspired by Steve Higham.
+
+2007-05-01  Vin Shelton  <acs at xemacs.org>
+
+	* nt.c (mswindows_stat): Tie _S_IEXEC permission to read access.
+	(mswindows_fstat): Ditto.
+	* sysfile.h: Under Windows, define X_OK to be the same as R_OK.
+
 2007-02-08  Adrian Aichner  <adrian at xemacs.org>
 
 	* postgresql.c: Update Steve Baur's email address by his request.



1.37.2.7  +5 -7      XEmacs/xemacs/src/Attic/callproc.c

Index: callproc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/Attic/callproc.c,v
retrieving revision 1.37.2.6
retrieving revision 1.37.2.7
diff -u -p -r1.37.2.6 -r1.37.2.7
--- callproc.c	2005/12/08 01:31:15	1.37.2.6
+++ callproc.c	2007/05/09 12:36:21	1.37.2.7
@@ -399,9 +399,6 @@ If you quit, the process is killed with 
 	  }
 #endif
       }
-    /* Close STDERR into the parent process.  We no longer need it. */
-    if (fd_error >= 0)
-      close (fd_error);
 #else  /* not WIN32_NATIVE */
     pid = fork ();
 
@@ -420,17 +417,18 @@ If you quit, the process is killed with 
 	child_setup (filefd, fd1, fd_error, new_argv,
 		     (char *) XSTRING_DATA (current_dir));
       }
-    if (fd_error >= 0)
-      close (fd_error);
-
 #endif /* not WIN32_NATIVE */
 
     environ = save_environ;
 
+    /* Close STDERR into the parent process.  We no longer need it. */
+    if (fd_error >= 0)
+      close (fd_error);
+
     /* Close most of our fd's, but not fd[0]
        since we will use that to read input from.  */
     close (filefd);
-    if (fd1 >= 0)
+    if ((fd1 >= 0) && (fd1 != fd_error))
       close (fd1);
   }
 



1.2.2.7   +2 -1      XEmacs/xemacs/src/dumper.c

Index: dumper.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/dumper.c,v
retrieving revision 1.2.2.6
retrieving revision 1.2.2.7
diff -u -p -r1.2.2.6 -r1.2.2.7
--- dumper.c	2006/07/01 05:19:56	1.2.2.6
+++ dumper.c	2007/05/09 12:36:22	1.2.2.7
@@ -1067,7 +1067,8 @@ pdump (void)
   pdump_dump_root_objects ();
 
   fclose (pdump_out);
-  close (pdump_fd);
+  /* pdump_fd is already closed by the preceding fclose call
+  close (pdump_fd); */
 
   free (pdump_buf);
 



1.21.2.5  +4 -14     XEmacs/xemacs/src/nt.c

Index: nt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/nt.c,v
retrieving revision 1.21.2.4
retrieving revision 1.21.2.5
diff -u -p -r1.21.2.4 -r1.21.2.5
--- nt.c	2005/01/31 02:55:24	1.21.2.4
+++ nt.c	2007/05/09 12:36:22	1.21.2.5
@@ -1449,9 +1449,9 @@ mswindows_fstat (int desc, struct stat *
 
   /* determine rwx permissions */
   if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
-    permission = _S_IREAD;
+    permission = _S_IREAD | _S_IEXEC;
   else
-    permission = _S_IREAD | _S_IWRITE;
+    permission = _S_IREAD | _S_IEXEC |_S_IWRITE;
   
   if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
     permission |= _S_IEXEC;
@@ -1638,22 +1638,12 @@ mswindows_stat (const char * path, struc
 
   /* determine rwx permissions */
   if (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
-    permission = _S_IREAD;
+    permission = _S_IREAD | _S_IEXEC;
   else
-    permission = _S_IREAD | _S_IWRITE;
+    permission = _S_IREAD | _S_IEXEC |_S_IWRITE;
   
   if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
     permission |= _S_IEXEC;
-  else
-    {
-      char * p = strrchr (name, '.');
-      if (p != NULL &&
-	  (stricmp (p, ".exe") == 0 ||
-	   stricmp (p, ".com") == 0 ||
-	   stricmp (p, ".bat") == 0 ||
-	   stricmp (p, ".cmd") == 0))
-	permission |= _S_IEXEC;
-    }
 
   buf->st_mode |= permission | (permission >> 3) | (permission >> 6);
 



1.9.2.2   +10 -4     XEmacs/xemacs/src/sysfile.h

Index: sysfile.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/sysfile.h,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -p -r1.9.2.1 -r1.9.2.2
--- sysfile.h	2001/07/25 07:45:39	1.9.2.1
+++ sysfile.h	2007/05/09 12:36:23	1.9.2.2
@@ -261,12 +261,18 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 /* The following definitions are needed under Windows, at least */
-#ifndef X_OK
-# define X_OK 1
-#endif
-
 #ifndef R_OK
 # define R_OK 4
+#endif
+
+/* Under native Windows, there is no concept of execute permission,
+   so redefine execute permissions to be the same as read permission */
+#ifndef X_OK
+# ifdef WIN32_NATIVE
+#  define X_OK R_OK
+# else
+#  define X_OK 1
+# endif
 #endif
 
 #ifndef W_OK





More information about the XEmacs-CVS mailing list