summaryrefslogtreecommitdiffabout
path: root/src/findkey.c
Unidiff
Diffstat (limited to 'src/findkey.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/findkey.c12
1 files changed, 4 insertions, 8 deletions
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,

Return to:

Send suggestions and report system problems to the System administrator.