Karsten Hopp c084b0
To: vim-dev@vim.org
Karsten Hopp c084b0
Subject: Patch 7.2.338
Karsten Hopp c084b0
Fcc: outbox
Karsten Hopp c084b0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c084b0
Mime-Version: 1.0
Karsten Hopp c084b0
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c084b0
Content-Transfer-Encoding: 8bit
Karsten Hopp c084b0
------------
Karsten Hopp c084b0
Karsten Hopp c084b0
Patch 7.2.338 (after 7.2.300)
Karsten Hopp c084b0
Problem:    Part of FD_CLOEXEC change is missing.
Karsten Hopp c084b0
Solution:   Include source file skipped because of typo.
Karsten Hopp c084b0
Files:	    src/ex_cmds2.c
Karsten Hopp c084b0
Karsten Hopp c084b0
Karsten Hopp c084b0
*** ../vim-7.2.337/src/ex_cmds2.c	2010-01-19 16:12:53.000000000 +0100
Karsten Hopp c084b0
--- src/ex_cmds2.c	2010-01-19 16:02:53.000000000 +0100
Karsten Hopp c084b0
***************
Karsten Hopp c084b0
*** 2802,2821 ****
Karsten Hopp c084b0
  
Karsten Hopp c084b0
  static char_u *get_one_sourceline __ARGS((struct source_cookie *sp));
Karsten Hopp c084b0
  
Karsten Hopp c084b0
! #if defined(WIN32) && defined(FEAT_CSCOPE)
Karsten Hopp c084b0
  static FILE *fopen_noinh_readbin __ARGS((char *filename));
Karsten Hopp c084b0
  
Karsten Hopp c084b0
  /*
Karsten Hopp c084b0
   * Special function to open a file without handle inheritance.
Karsten Hopp c084b0
   */
Karsten Hopp c084b0
      static FILE *
Karsten Hopp c084b0
  fopen_noinh_readbin(filename)
Karsten Hopp c084b0
      char    *filename;
Karsten Hopp c084b0
  {
Karsten Hopp c084b0
!     int	fd_tmp = mch_open(filename, O_RDONLY | O_BINARY | O_NOINHERIT, 0);
Karsten Hopp c084b0
  
Karsten Hopp c084b0
      if (fd_tmp == -1)
Karsten Hopp c084b0
  	return NULL;
Karsten Hopp c084b0
      return fdopen(fd_tmp, READBIN);
Karsten Hopp c084b0
  }
Karsten Hopp c084b0
  #endif
Karsten Hopp c084b0
--- 2802,2836 ----
Karsten Hopp c084b0
  
Karsten Hopp c084b0
  static char_u *get_one_sourceline __ARGS((struct source_cookie *sp));
Karsten Hopp c084b0
  
Karsten Hopp c084b0
! #if (defined(WIN32) && defined(FEAT_CSCOPE)) || defined(HAVE_FD_CLOEXEC)
Karsten Hopp c084b0
! # define USE_FOPEN_NOINH
Karsten Hopp c084b0
  static FILE *fopen_noinh_readbin __ARGS((char *filename));
Karsten Hopp c084b0
  
Karsten Hopp c084b0
  /*
Karsten Hopp c084b0
   * Special function to open a file without handle inheritance.
Karsten Hopp c084b0
+  * When possible the handle is closed on exec().
Karsten Hopp c084b0
   */
Karsten Hopp c084b0
      static FILE *
Karsten Hopp c084b0
  fopen_noinh_readbin(filename)
Karsten Hopp c084b0
      char    *filename;
Karsten Hopp c084b0
  {
Karsten Hopp c084b0
!     int	fd_tmp = mch_open(filename, O_RDONLY
Karsten Hopp c084b0
! # ifdef WIN32
Karsten Hopp c084b0
! 			  O_BINARY | O_NOINHERIT
Karsten Hopp c084b0
! # endif
Karsten Hopp c084b0
! 			  , 0);
Karsten Hopp c084b0
  
Karsten Hopp c084b0
      if (fd_tmp == -1)
Karsten Hopp c084b0
  	return NULL;
Karsten Hopp c084b0
+ 
Karsten Hopp c084b0
+ # ifdef HAVE_FD_CLOEXEC
Karsten Hopp c084b0
+     {
Karsten Hopp c084b0
+ 	int fdflags = fcntl(fd_tmp, F_GETFD);
Karsten Hopp c084b0
+ 	if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
Karsten Hopp c084b0
+ 	    fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC);
Karsten Hopp c084b0
+     }
Karsten Hopp c084b0
+ # endif
Karsten Hopp c084b0
+ 
Karsten Hopp c084b0
      return fdopen(fd_tmp, READBIN);
Karsten Hopp c084b0
  }
Karsten Hopp c084b0
  #endif
Karsten Hopp c084b0
***************
Karsten Hopp c084b0
*** 2895,2901 ****
Karsten Hopp c084b0
      apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
Karsten Hopp c084b0
  #endif
Karsten Hopp c084b0
  
Karsten Hopp c084b0
! #if defined(WIN32) && defined(FEAT_CSCOPE)
Karsten Hopp c084b0
      cookie.fp = fopen_noinh_readbin((char *)fname_exp);
Karsten Hopp c084b0
  #else
Karsten Hopp c084b0
      cookie.fp = mch_fopen((char *)fname_exp, READBIN);
Karsten Hopp c084b0
--- 2910,2916 ----
Karsten Hopp c084b0
      apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
Karsten Hopp c084b0
  #endif
Karsten Hopp c084b0
  
Karsten Hopp c084b0
! #ifdef USE_FOPEN_NOINH
Karsten Hopp c084b0
      cookie.fp = fopen_noinh_readbin((char *)fname_exp);
Karsten Hopp c084b0
  #else
Karsten Hopp c084b0
      cookie.fp = mch_fopen((char *)fname_exp, READBIN);
Karsten Hopp c084b0
***************
Karsten Hopp c084b0
*** 2916,2922 ****
Karsten Hopp c084b0
  		*p = '.';
Karsten Hopp c084b0
  	    else
Karsten Hopp c084b0
  		*p = '_';
Karsten Hopp c084b0
! #if defined(WIN32) && defined(FEAT_CSCOPE)
Karsten Hopp c084b0
  	    cookie.fp = fopen_noinh_readbin((char *)fname_exp);
Karsten Hopp c084b0
  #else
Karsten Hopp c084b0
  	    cookie.fp = mch_fopen((char *)fname_exp, READBIN);
Karsten Hopp c084b0
--- 2931,2937 ----
Karsten Hopp c084b0
  		*p = '.';
Karsten Hopp c084b0
  	    else
Karsten Hopp c084b0
  		*p = '_';
Karsten Hopp c084b0
! #ifdef USE_FOPEN_NOINH
Karsten Hopp c084b0
  	    cookie.fp = fopen_noinh_readbin((char *)fname_exp);
Karsten Hopp c084b0
  #else
Karsten Hopp c084b0
  	    cookie.fp = mch_fopen((char *)fname_exp, READBIN);
Karsten Hopp c084b0
*** ../vim-7.2.337/src/version.c	2010-01-19 16:12:53.000000000 +0100
Karsten Hopp c084b0
--- src/version.c	2010-01-19 16:20:08.000000000 +0100
Karsten Hopp c084b0
***************
Karsten Hopp c084b0
*** 683,684 ****
Karsten Hopp c084b0
--- 683,686 ----
Karsten Hopp c084b0
  {   /* Add new patch number below this line */
Karsten Hopp c084b0
+ /**/
Karsten Hopp c084b0
+     338,
Karsten Hopp c084b0
  /**/
Karsten Hopp c084b0
Karsten Hopp c084b0
-- 
Karsten Hopp c084b0
~
Karsten Hopp c084b0
~
Karsten Hopp c084b0
~
Karsten Hopp c084b0
".signature" 4 lines, 50 characters written
Karsten Hopp c084b0
Karsten Hopp c084b0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c084b0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c084b0
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp c084b0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///