Karsten Hopp 81c285
To: vim-dev@vim.org
Karsten Hopp 81c285
Subject: Patch 7.2.170
Karsten Hopp 81c285
Fcc: outbox
Karsten Hopp 81c285
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 81c285
Mime-Version: 1.0
Karsten Hopp 81c285
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 81c285
Content-Transfer-Encoding: 8bit
Karsten Hopp 81c285
------------
Karsten Hopp 81c285
Karsten Hopp 81c285
Patch 7.2.170
Karsten Hopp 81c285
Problem:    Using b_dev while it was not set. (Dominique Pelle)
Karsten Hopp 81c285
Solution:   Add the b_dev_valid flag.
Karsten Hopp 81c285
Files:	    src/buffer.c, src/fileio.c, src/structs.h
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
*** ../vim-7.2.169/src/buffer.c	2009-05-13 12:46:36.000000000 +0200
Karsten Hopp 81c285
--- src/buffer.c	2009-05-13 20:23:51.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1678,1686 ****
Karsten Hopp 81c285
      buf->b_fname = buf->b_sfname;
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
      if (st.st_dev == (dev_T)-1)
Karsten Hopp 81c285
! 	buf->b_dev = -1;
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
--- 1678,1687 ----
Karsten Hopp 81c285
      buf->b_fname = buf->b_sfname;
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
      if (st.st_dev == (dev_T)-1)
Karsten Hopp 81c285
! 	buf->b_dev_valid = FALSE;
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
+ 	buf->b_dev_valid = TRUE;
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 2693,2701 ****
Karsten Hopp 81c285
      buf->b_fname = buf->b_sfname;
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
      if (st.st_dev == (dev_T)-1)
Karsten Hopp 81c285
! 	buf->b_dev = -1;
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
--- 2694,2703 ----
Karsten Hopp 81c285
      buf->b_fname = buf->b_sfname;
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
      if (st.st_dev == (dev_T)-1)
Karsten Hopp 81c285
! 	buf->b_dev_valid = FALSE;
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
+ 	buf->b_dev_valid = TRUE;
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 2889,2895 ****
Karsten Hopp 81c285
  	/* If no struct stat given, get it now */
Karsten Hopp 81c285
  	if (stp == NULL)
Karsten Hopp 81c285
  	{
Karsten Hopp 81c285
! 	    if (buf->b_dev < 0 || mch_stat((char *)ffname, &st) < 0)
Karsten Hopp 81c285
  		st.st_dev = (dev_T)-1;
Karsten Hopp 81c285
  	    stp = &st;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
--- 2891,2897 ----
Karsten Hopp 81c285
  	/* If no struct stat given, get it now */
Karsten Hopp 81c285
  	if (stp == NULL)
Karsten Hopp 81c285
  	{
Karsten Hopp 81c285
! 	    if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
Karsten Hopp 81c285
  		st.st_dev = (dev_T)-1;
Karsten Hopp 81c285
  	    stp = &st;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 2926,2936 ****
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
! 	buf->b_dev = -1;
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  /*
Karsten Hopp 81c285
--- 2928,2939 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
+ 	buf->b_dev_valid = TRUE;
Karsten Hopp 81c285
  	buf->b_dev = st.st_dev;
Karsten Hopp 81c285
  	buf->b_ino = st.st_ino;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
      else
Karsten Hopp 81c285
! 	buf->b_dev_valid = FALSE;
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  /*
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 2941,2947 ****
Karsten Hopp 81c285
      buf_T	*buf;
Karsten Hopp 81c285
      struct stat *stp;
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
!     return (buf->b_dev >= 0
Karsten Hopp 81c285
  	    && stp->st_dev == buf->b_dev
Karsten Hopp 81c285
  	    && stp->st_ino == buf->b_ino);
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
--- 2944,2950 ----
Karsten Hopp 81c285
      buf_T	*buf;
Karsten Hopp 81c285
      struct stat *stp;
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
!     return (buf->b_dev_valid
Karsten Hopp 81c285
  	    && stp->st_dev == buf->b_dev
Karsten Hopp 81c285
  	    && stp->st_ino == buf->b_ino);
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
*** ../vim-7.2.169/src/fileio.c	2009-04-29 18:01:23.000000000 +0200
Karsten Hopp 81c285
--- src/fileio.c	2009-05-13 20:24:08.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 4416,4422 ****
Karsten Hopp 81c285
  # endif
Karsten Hopp 81c285
  	buf_setino(buf);
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if (buf->b_dev < 0)
Karsten Hopp 81c285
  	/* Set the inode when creating a new file. */
Karsten Hopp 81c285
  	buf_setino(buf);
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
--- 4416,4422 ----
Karsten Hopp 81c285
  # endif
Karsten Hopp 81c285
  	buf_setino(buf);
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if (!buf->b_dev_valid)
Karsten Hopp 81c285
  	/* Set the inode when creating a new file. */
Karsten Hopp 81c285
  	buf_setino(buf);
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
*** ../vim-7.2.169/src/structs.h	2009-05-13 18:54:14.000000000 +0200
Karsten Hopp 81c285
--- src/structs.h	2009-05-13 20:24:54.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1166,1172 ****
Karsten Hopp 81c285
      char_u	*b_fname;	/* current file name */
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
!     dev_t	b_dev;		/* device number (-1 if not set) */
Karsten Hopp 81c285
      ino_t	b_ino;		/* inode number */
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifdef FEAT_CW_EDITOR
Karsten Hopp 81c285
--- 1166,1173 ----
Karsten Hopp 81c285
      char_u	*b_fname;	/* current file name */
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  #ifdef UNIX
Karsten Hopp 81c285
!     int		b_dev_valid;	/* TRUE when b_dev has a valid number */
Karsten Hopp 81c285
!     dev_t	b_dev;		/* device number */
Karsten Hopp 81c285
      ino_t	b_ino;		/* inode number */
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifdef FEAT_CW_EDITOR
Karsten Hopp 81c285
*** ../vim-7.2.169/src/version.c	2009-05-13 18:54:14.000000000 +0200
Karsten Hopp 81c285
--- src/version.c	2009-05-13 20:43:22.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 678,679 ****
Karsten Hopp 81c285
--- 678,681 ----
Karsten Hopp 81c285
  {   /* Add new patch number below this line */
Karsten Hopp 81c285
+ /**/
Karsten Hopp 81c285
+     170,
Karsten Hopp 81c285
  /**/
Karsten Hopp 81c285
Karsten Hopp 81c285
-- 
Karsten Hopp 81c285
A special cleaning ordinance bans housewives from hiding dirt and dust under a
Karsten Hopp 81c285
rug in a dwelling.
Karsten Hopp 81c285
		[real standing law in Pennsylvania, United States of America]
Karsten Hopp 81c285
Karsten Hopp 81c285
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 81c285
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 81c285
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 81c285
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///