1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
To: vim-dev@vim.org
Subject: Patch 7.2.170
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.2.170
Problem: Using b_dev while it was not set. (Dominique Pelle)
Solution: Add the b_dev_valid flag.
Files: src/buffer.c, src/fileio.c, src/structs.h
*** ../vim-7.2.169/src/buffer.c 2009-05-13 12:46:36.000000000 +0200
--- src/buffer.c 2009-05-13 20:23:51.000000000 +0200
***************
*** 1678,1686 ****
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
! buf->b_dev = -1;
else
{
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
--- 1678,1687 ----
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
! buf->b_dev_valid = FALSE;
else
{
+ buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
***************
*** 2693,2701 ****
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
! buf->b_dev = -1;
else
{
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
--- 2694,2703 ----
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
! buf->b_dev_valid = FALSE;
else
{
+ buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
***************
*** 2889,2895 ****
/* If no struct stat given, get it now */
if (stp == NULL)
{
! if (buf->b_dev < 0 || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
--- 2891,2897 ----
/* If no struct stat given, get it now */
if (stp == NULL)
{
! if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
***************
*** 2926,2936 ****
if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
{
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
else
! buf->b_dev = -1;
}
/*
--- 2928,2939 ----
if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
{
+ buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
else
! buf->b_dev_valid = FALSE;
}
/*
***************
*** 2941,2947 ****
buf_T *buf;
struct stat *stp;
{
! return (buf->b_dev >= 0
&& stp->st_dev == buf->b_dev
&& stp->st_ino == buf->b_ino);
}
--- 2944,2950 ----
buf_T *buf;
struct stat *stp;
{
! return (buf->b_dev_valid
&& stp->st_dev == buf->b_dev
&& stp->st_ino == buf->b_ino);
}
*** ../vim-7.2.169/src/fileio.c 2009-04-29 18:01:23.000000000 +0200
--- src/fileio.c 2009-05-13 20:24:08.000000000 +0200
***************
*** 4416,4422 ****
# endif
buf_setino(buf);
}
! else if (buf->b_dev < 0)
/* Set the inode when creating a new file. */
buf_setino(buf);
#endif
--- 4416,4422 ----
# endif
buf_setino(buf);
}
! else if (!buf->b_dev_valid)
/* Set the inode when creating a new file. */
buf_setino(buf);
#endif
*** ../vim-7.2.169/src/structs.h 2009-05-13 18:54:14.000000000 +0200
--- src/structs.h 2009-05-13 20:24:54.000000000 +0200
***************
*** 1166,1172 ****
char_u *b_fname; /* current file name */
#ifdef UNIX
! dev_t b_dev; /* device number (-1 if not set) */
ino_t b_ino; /* inode number */
#endif
#ifdef FEAT_CW_EDITOR
--- 1166,1173 ----
char_u *b_fname; /* current file name */
#ifdef UNIX
! int b_dev_valid; /* TRUE when b_dev has a valid number */
! dev_t b_dev; /* device number */
ino_t b_ino; /* inode number */
#endif
#ifdef FEAT_CW_EDITOR
*** ../vim-7.2.169/src/version.c 2009-05-13 18:54:14.000000000 +0200
--- src/version.c 2009-05-13 20:43:22.000000000 +0200
***************
*** 678,679 ****
--- 678,681 ----
{ /* Add new patch number below this line */
+ /**/
+ 170,
/**/
--
A special cleaning ordinance bans housewives from hiding dirt and dust under a
rug in a dwelling.
[real standing law in Pennsylvania, United States of America]
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|