summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org>2018-05-30 09:32:31 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-05-30 09:32:31 (GMT)
commita14a6881538229cd938282bd56c7f0d12a089be6 (patch) (unidiff)
tree89cfa47078460e7505c1a80ce71488eef29dfc63 /src
parent07caec236e3af48973874f2c0e19bafec4d13f78 (diff)
downloadgdbm-a14a6881538229cd938282bd56c7f0d12a089be6.tar.gz
gdbm-a14a6881538229cd938282bd56c7f0d12a089be6.tar.bz2
Drop debugging hooks
The hooks were introduced as a temporary tool in de7834e9. They did their job and are not necessary any more.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/bucket.c17
-rw-r--r--src/debug.c137
-rw-r--r--src/falloc.c18
-rw-r--r--src/findkey.c12
-rw-r--r--src/gdbmdefs.h14
-rw-r--r--src/gdbmopen.c8
-rw-r--r--src/gdbmstore.c10
-rw-r--r--src/lex.l2
-rw-r--r--src/update.c12
9 files changed, 26 insertions, 204 deletions
diff --git a/src/bucket.c b/src/bucket.c
index c75db42..2289594 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -112,8 +112,7 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
112 /* It is not in the cache, read it from the disk. */ 112 /* It is not in the cache, read it from the disk. */
113 113
114 /* Position the file pointer */ 114 /* Position the file pointer */
115 file_pos = GDBM_DEBUG_OVERRIDE ("_gdbm_get_bucket:seek-failure", 115 file_pos = __lseek (dbf, bucket_adr, SEEK_SET);
116 __lseek (dbf, bucket_adr, SEEK_SET));
117 if (file_pos != bucket_adr) 116 if (file_pos != bucket_adr)
118 { 117 {
119 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 118 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
@@ -131,9 +130,8 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
131 _gdbm_cache_entry_invalidate (dbf, lru); 130 _gdbm_cache_entry_invalidate (dbf, lru);
132 131
133 /* Read the bucket. */ 132 /* Read the bucket. */
134 rc = GDBM_DEBUG_OVERRIDE ("_gdbm_get_bucket:read-failure", 133 rc = _gdbm_full_read (dbf, dbf->bucket_cache[lru].ca_bucket,
135 _gdbm_full_read (dbf, dbf->bucket_cache[lru].ca_bucket, 134 dbf->header->bucket_size);
136 dbf->header->bucket_size));
137 if (rc) 135 if (rc)
138 { 136 {
139 GDBM_DEBUG (GDBM_DEBUG_ERR, 137 GDBM_DEBUG (GDBM_DEBUG_ERR,
@@ -302,8 +300,7 @@ _gdbm_split_bucket (GDBM_FILE dbf, int next_insert)
302 dir_adr = _gdbm_alloc (dbf, dir_size); 300 dir_adr = _gdbm_alloc (dbf, dir_size);
303 if (dir_adr == 0) 301 if (dir_adr == 0)
304 return -1; 302 return -1;
305 new_dir = GDBM_DEBUG_ALLOC ("_gdbm_split_bucket:malloc-failure", 303 new_dir = malloc (dir_size);
306 malloc (dir_size));
307 if (new_dir == NULL) 304 if (new_dir == NULL)
308 { 305 {
309 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 306 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
@@ -435,16 +432,14 @@ _gdbm_write_bucket (GDBM_FILE dbf, cache_elem *ca_entry)
435 int rc; 432 int rc;
436 off_t file_pos;/* The return value for lseek. */ 433 off_t file_pos;/* The return value for lseek. */
437 434
438 file_pos = GDBM_DEBUG_OVERRIDE ("_gdbm_write_bucket:seek-failure", 435 file_pos = __lseek (dbf, ca_entry->ca_adr, SEEK_SET);
439 __lseek (dbf, ca_entry->ca_adr, SEEK_SET));
440 if (file_pos != ca_entry->ca_adr) 436 if (file_pos != ca_entry->ca_adr)
441 { 437 {
442 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 438 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
443 _gdbm_fatal (dbf, _("lseek error")); 439 _gdbm_fatal (dbf, _("lseek error"));
444 return -1; 440 return -1;
445 } 441 }
446 rc = GDBM_DEBUG_OVERRIDE ("_gdbm_write_bucket:write-failure", 442 rc = _gdbm_full_write (dbf, ca_entry->ca_bucket, dbf->header->bucket_size);
447 _gdbm_full_write (dbf, ca_entry->ca_bucket, dbf->header->bucket_size));
448 if (rc) 443 if (rc)
449 { 444 {
450 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 445 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
diff --git a/src/debug.c b/src/debug.c
index 00f568c..08957ed 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -136,140 +136,3 @@ gdbm_debug_datum (datum dat, char const *pfx)
136 } 136 }
137} 137}
138 138
139
140struct hook_list
141{
142 struct hook_list *next;
143 struct hook_list *prev;
144 char *id;
145 gdbm_debug_hook hook;
146 void *data;
147 int retval;
148};
149
150static struct hook_list *hook_head, *hook_tail;
151static struct hook_list *hook_recent;
152
153static struct hook_list *
154hook_lookup_or_install (char const *id, int install)
155{
156 struct hook_list *p;
157
158 for (p = hook_head; p; p = p->next)
159 {
160 int res = strcmp (p->id, id);
161 if (res == 0)
162 return p;
163 if (res > 0)
164 break;
165 }
166
167 if (install)
168 {
169 struct hook_list *elt = malloc (sizeof *elt);
170 if (!elt)
171 return NULL;
172 elt->id = strdup (id);
173 if (!elt->id)
174 {
175 SAVE_ERRNO (free (elt));
176 return NULL;
177 }
178 elt->hook = NULL;
179 elt->next = p;
180 if (p)
181 {
182 if (p->prev)
183 p->prev->next = elt;
184 else
185 hook_head = elt;
186 elt->prev = p->prev;
187 }
188 else
189 {
190 elt->prev = hook_tail;
191 if (hook_tail)
192 hook_tail->next = elt;
193 else
194 hook_head = elt;
195 hook_tail = elt;
196 }
197 return elt;
198 }
199
200 return NULL;
201}
202
203static struct hook_list *
204hook_lookup (char const *id)
205{
206 if (!(hook_recent && strcmp (hook_recent->id, id) == 0))
207 hook_recent = hook_lookup_or_install (id, FALSE);
208 return hook_recent;
209}
210
211static void
212hook_remove (char const *id)
213{
214 struct hook_list *p;
215
216 p = hook_lookup (id);
217 if (!p)
218 return;
219
220 hook_recent = NULL;
221
222 if (p->prev)
223 p->prev->next = p->next;
224 else
225 hook_head = p->next;
226
227 if (p->next)
228 p->next->prev = p->prev;
229 else
230 hook_tail = p->prev;
231
232 free (p->id);
233 free (p);
234}
235
236static int
237default_hook (char const *file, int line, char const *id, void *data)
238{
239 fprintf (stderr, "%s:%d: hit debug hook %s\n", file, line, id);
240 return 1;
241}
242
243void
244_gdbm_debug_hook_install (char const *id, gdbm_debug_hook hook, void *data)
245{
246 struct hook_list *p;
247
248 p = hook_lookup_or_install (id, TRUE);
249 p->hook = hook ? hook : default_hook;
250 p->data = data;
251}
252
253void
254_gdbm_debug_hook_remove (char const *id)
255{
256 hook_remove (id);
257}
258
259int
260_gdbm_debug_hook_check (char const *file, int line, char const *id)
261{
262 struct hook_list *p = hook_lookup (id);
263 if (p)
264 return p->retval = p->hook (file, line, id, p->data);
265 return 0;
266}
267
268int
269_gdbm_debug_hook_val (char const *id)
270{
271 struct hook_list *p = hook_lookup (id);
272 if (p)
273 return p->retval;
274 return 0;
275}
diff --git a/src/falloc.c b/src/falloc.c
index c3bd145..13ee0ed 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -182,8 +182,7 @@ pop_avail_block (GDBM_FILE dbf)
182 + sizeof (avail_block)); 182 + sizeof (avail_block));
183 183
184 /* Allocate space for the block. */ 184 /* Allocate space for the block. */
185 new_blk = GDBM_DEBUG_ALLOC ("pop_avail_block:malloc-failure", 185 new_blk = malloc (new_el.av_size);
186 malloc (new_el.av_size));
187 if (new_blk == NULL) 186 if (new_blk == NULL)
188 { 187 {
189 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 188 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
@@ -192,8 +191,7 @@ pop_avail_block (GDBM_FILE dbf)
192 } 191 }
193 192
194 /* Read the block. */ 193 /* Read the block. */
195 file_pos = GDBM_DEBUG_OVERRIDE ("pop_avail_block:lseek-failure", 194 file_pos = __lseek (dbf, new_el.av_adr, SEEK_SET);
196 __lseek (dbf, new_el.av_adr, SEEK_SET));
197 if (file_pos != new_el.av_adr) 195 if (file_pos != new_el.av_adr)
198 { 196 {
199 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 197 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
@@ -202,8 +200,7 @@ pop_avail_block (GDBM_FILE dbf)
202 return -1; 200 return -1;
203 } 201 }
204 202
205 rc = GDBM_DEBUG_OVERRIDE ("pop_avail_block:read-failure", 203 rc = _gdbm_full_read (dbf, new_blk, new_el.av_size);
206 _gdbm_full_read (dbf, new_blk, new_el.av_size));
207 if (rc) 204 if (rc)
208 { 205 {
209 free (new_blk); 206 free (new_blk);
@@ -295,8 +292,7 @@ push_avail_block (GDBM_FILE dbf)
295 av_adr = new_loc.av_adr; 292 av_adr = new_loc.av_adr;
296 293
297 /* Split the header block. */ 294 /* Split the header block. */
298 temp = GDBM_DEBUG_ALLOC ("push_avail_block:malloc-failure", 295 temp = malloc (av_size);
299 malloc (av_size));
300 if (temp == NULL) 296 if (temp == NULL)
301 { 297 {
302 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 298 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
@@ -325,8 +321,7 @@ push_avail_block (GDBM_FILE dbf)
325 _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size); 321 _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size);
326 322
327 /* Update the disk. */ 323 /* Update the disk. */
328 file_pos = GDBM_DEBUG_OVERRIDE ("push_avail_block:lseek-failure", 324 file_pos = __lseek (dbf, av_adr, SEEK_SET);
329 __lseek (dbf, av_adr, SEEK_SET));
330 if (file_pos != av_adr) 325 if (file_pos != av_adr)
331 { 326 {
332 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 327 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
@@ -334,8 +329,7 @@ push_avail_block (GDBM_FILE dbf)
334 return -1; 329 return -1;
335 } 330 }
336 331
337 rc = GDBM_DEBUG_OVERRIDE ("push_avail_block:write-failure", 332 rc = _gdbm_full_write (dbf, temp, av_size);
338 _gdbm_full_write (dbf, temp, av_size));
339 if (rc) 333 if (rc)
340 { 334 {
341 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 335 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
diff --git a/src/findkey.c b/src/findkey.c
index bd9fd83..9bb4553 100644
--- a/src/findkey.c
+++ b/src/findkey.c
@@ -71,9 +71,7 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
71 data_ca->elem_loc = elem_loc; 71 data_ca->elem_loc = elem_loc;
72 data_ca->hash_val = dbf->bucket->h_table[elem_loc].hash_value; 72 data_ca->hash_val = dbf->bucket->h_table[elem_loc].hash_value;
73 73
74 if (GDBM_DEBUG_HOOK ("_gdbm_read_entry:malloc-failure")) 74 if (key_size + data_size == 0)
75 data_ca->dptr = NULL;
76 else if (key_size + data_size == 0)
77 data_ca->dptr = (char *) malloc (1); 75 data_ca->dptr = (char *) malloc (1);
78 else 76 else
79 data_ca->dptr = (char *) malloc (key_size + data_size); 77 data_ca->dptr = (char *) malloc (key_size + data_size);
@@ -85,9 +83,8 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
85 } 83 }
86 84
87 /* Read into the cache. */ 85 /* Read into the cache. */
88 file_pos = GDBM_DEBUG_OVERRIDE ("_gdbm_read_entry:lseek-failure", 86 file_pos = __lseek (dbf, dbf->bucket->h_table[elem_loc].data_pointer,
89 __lseek (dbf, dbf->bucket->h_table[elem_loc].data_pointer, 87 SEEK_SET);
90 SEEK_SET));
91 if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer) 88 if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer)
92 { 89 {
93 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_LOOKUP); 90 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_LOOKUP);
@@ -95,8 +92,7 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
95 return NULL; 92 return NULL;
96 } 93 }
97 94
98 rc = GDBM_DEBUG_OVERRIDE ("_gdbm_read_entry:read-failure", 95 rc = _gdbm_full_read (dbf, data_ca->dptr, key_size+data_size);
99 _gdbm_full_read (dbf, data_ca->dptr, key_size+data_size));
100 if (rc) 96 if (rc)
101 { 97 {
102 GDBM_DEBUG (GDBM_DEBUG_ERR|GDBM_DEBUG_LOOKUP|GDBM_DEBUG_READ, 98 GDBM_DEBUG (GDBM_DEBUG_ERR|GDBM_DEBUG_LOOKUP|GDBM_DEBUG_READ,
diff --git a/src/gdbmdefs.h b/src/gdbmdefs.h
index d940c5d..4ae646f 100644
--- a/src/gdbmdefs.h
+++ b/src/gdbmdefs.h
@@ -325,23 +325,9 @@ struct gdbm_file_info
325 gdbm_set_errno(dbf, ec, fatal); \ 325 gdbm_set_errno(dbf, ec, fatal); \
326 } \ 326 } \
327 while (0) 327 while (0)
328
329typedef int (*gdbm_debug_hook) (char const *, int, char const *, void *);
330extern void _gdbm_debug_hook_install (char const *, gdbm_debug_hook, void *);
331extern void _gdbm_debug_hook_remove (char const *);
332extern int _gdbm_debug_hook_check (char const *, int, char const *);
333extern int _gdbm_debug_hook_val (char const *);
334# define GDBM_DEBUG_HOOK(id) _gdbm_debug_hook_check(__FILE__,__LINE__,id)
335 # define GDBM_DEBUG_OVERRIDE(id, stmt) \
336 (GDBM_DEBUG_HOOK(id) ? _gdbm_debug_hook_val(id) : (stmt))
337 # define GDBM_DEBUG_ALLOC(id, stmt) \
338 (GDBM_DEBUG_HOOK(id) ? NULL : (stmt))
339#else 328#else
340# define GDBM_DEBUG(flags, fmt, ...) 329# define GDBM_DEBUG(flags, fmt, ...)
341# define GDBM_DEBUG_DATUM(flags, dat, fmt, ...) 330# define GDBM_DEBUG_DATUM(flags, dat, fmt, ...)
342# define GDBM_DEBUG_HOOK(id) 0
343# define GDBM_DEBUG_OVERRIDE(id, stmt) (stmt)
344# define GDBM_DEBUG_ALLOC(id, stmt) (stmt)
345# define GDBM_SET_ERRNO2(dbf, ec, fatal, m) gdbm_set_errno (dbf, ec, fatal) 331# define GDBM_SET_ERRNO2(dbf, ec, fatal, m) gdbm_set_errno (dbf, ec, fatal)
346#endif 332#endif
347 333
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index 9c10d3d..22e7ca6 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -634,8 +634,7 @@ _gdbm_init_cache (GDBM_FILE dbf, size_t size)
634 634
635 if (dbf->bucket_cache == NULL) 635 if (dbf->bucket_cache == NULL)
636 { 636 {
637 dbf->bucket_cache = GDBM_DEBUG_ALLOC ("_gdbm_init_cache:malloc-failure", 637 dbf->bucket_cache = calloc (size, sizeof(cache_elem));
638 calloc (size, sizeof(cache_elem)));
639 if (dbf->bucket_cache == NULL) 638 if (dbf->bucket_cache == NULL)
640 { 639 {
641 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 640 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
@@ -645,9 +644,8 @@ _gdbm_init_cache (GDBM_FILE dbf, size_t size)
645 644
646 for (index = 0; index < size; index++) 645 for (index = 0; index < size; index++)
647 { 646 {
648 (dbf->bucket_cache[index]).ca_bucket = 647 (dbf->bucket_cache[index]).ca_bucket =
649 GDBM_DEBUG_ALLOC ("_gdbm_init_cache:bucket-malloc-failure", 648 malloc (dbf->header->bucket_size);
650 malloc (dbf->header->bucket_size));
651 if ((dbf->bucket_cache[index]).ca_bucket == NULL) 649 if ((dbf->bucket_cache[index]).ca_bucket == NULL)
652 { 650 {
653 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 651 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
diff --git a/src/gdbmstore.c b/src/gdbmstore.c
index 2ed1616..6b498b2 100644
--- a/src/gdbmstore.c
+++ b/src/gdbmstore.c
@@ -160,8 +160,7 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
160 dbf->bucket->h_table[elem_loc].data_size = content.dsize; 160 dbf->bucket->h_table[elem_loc].data_size = content.dsize;
161 161
162 /* Write the data to the file. */ 162 /* Write the data to the file. */
163 file_pos = GDBM_DEBUG_OVERRIDE ("gdbm_store:seek-failure", 163 file_pos = __lseek (dbf, file_adr, SEEK_SET);
164 __lseek (dbf, file_adr, SEEK_SET));
165 if (file_pos != file_adr) 164 if (file_pos != file_adr)
166 { 165 {
167 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 166 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
@@ -171,8 +170,7 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
171 return -1; 170 return -1;
172 } 171 }
173 172
174 rc = GDBM_DEBUG_OVERRIDE ("gdbm_store:write-1-failure", 173 rc = _gdbm_full_write (dbf, key.dptr, key.dsize);
175 _gdbm_full_write (dbf, key.dptr, key.dsize));
176 if (rc) 174 if (rc)
177 { 175 {
178 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 176 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
@@ -182,9 +180,7 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
182 return -1; 180 return -1;
183 } 181 }
184 182
185 rc = GDBM_DEBUG_OVERRIDE ("gdbm_store:write-2-failure", 183 rc = _gdbm_full_write (dbf, content.dptr, content.dsize);
186 _gdbm_full_write (dbf,
187 content.dptr, content.dsize));
188 if (rc) 184 if (rc)
189 { 185 {
190 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 186 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
diff --git a/src/lex.l b/src/lex.l
index eff2ec7..0318031 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -121,9 +121,7 @@ input_context_push (instream_t input)
121void 121void
122lex_trace (int n) 122lex_trace (int n)
123{ 123{
124#if GDBMTOOL_DEBUG
125 yy_flex_debug = n; 124 yy_flex_debug = n;
126#endif
127} 125}
128 126
129int 127int
diff --git a/src/update.c b/src/update.c
index 63c6c95..f4b8b78 100644
--- a/src/update.c
+++ b/src/update.c
@@ -30,8 +30,7 @@ write_header (GDBM_FILE dbf)
30 off_t file_pos;/* Return value for lseek. */ 30 off_t file_pos;/* Return value for lseek. */
31 int rc; 31 int rc;
32 32
33 file_pos = GDBM_DEBUG_OVERRIDE ("write_header:lseek-failure", 33 file_pos = __lseek (dbf, 0L, SEEK_SET);
34 __lseek (dbf, 0L, SEEK_SET));
35 if (file_pos != 0) 34 if (file_pos != 0)
36 { 35 {
37 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_STORE); 36 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_STORE);
@@ -39,8 +38,7 @@ write_header (GDBM_FILE dbf)
39 return -1; 38 return -1;
40 } 39 }
41 40
42 rc = GDBM_DEBUG_OVERRIDE ("write_header:write-failure", 41 rc = _gdbm_full_write (dbf, dbf->header, dbf->header->block_size);
43 _gdbm_full_write (dbf, dbf->header, dbf->header->block_size));
44 42
45 if (rc) 43 if (rc)
46 { 44 {
@@ -96,8 +94,7 @@ _gdbm_end_update (GDBM_FILE dbf)
96 /* Write the directory. */ 94 /* Write the directory. */
97 if (dbf->directory_changed) 95 if (dbf->directory_changed)
98 { 96 {
99 file_pos = GDBM_DEBUG_OVERRIDE ("_gdbm_end_update:lseek-failure", 97 file_pos = __lseek (dbf, dbf->header->dir, SEEK_SET);
100 __lseek (dbf, dbf->header->dir, SEEK_SET));
101 if (file_pos != dbf->header->dir) 98 if (file_pos != dbf->header->dir)
102 { 99 {
103 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_STORE); 100 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_STORE);
@@ -105,8 +102,7 @@ _gdbm_end_update (GDBM_FILE dbf)
105 return -1; 102 return -1;
106 } 103 }
107 104
108 rc = GDBM_DEBUG_OVERRIDE ("_gdbm_end_update:write-dir-failure", 105 rc = _gdbm_full_write (dbf, dbf->dir, dbf->header->dir_size);
109 _gdbm_full_write (dbf, dbf->dir, dbf->header->dir_size));
110 if (rc) 106 if (rc)
111 { 107 {
112 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR, 108 GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,

Return to:

Send suggestions and report system problems to the System administrator.