Lines 117-125
Header hdrcache_get(const char *path, const struct stat *st, unsigned *off)
Link Here
|
117 |
mcdb_put(env, key, keysize, data, datasize); |
117 |
mcdb_put(env, key, keysize, data, datasize); |
118 |
} |
118 |
} |
119 |
void *blob = data->blob; |
119 |
void *blob = data->blob; |
|
|
120 |
int blobsize = datasize - sizeof(struct cache_ent) + 1; |
120 |
char ublob[hdrsize_max]; |
121 |
char ublob[hdrsize_max]; |
121 |
if (data->vflags & V_LZO) { |
122 |
if (data->vflags & V_LZO) { |
122 |
int blobsize = datasize - sizeof(struct cache_ent) + 1; |
|
|
123 |
lzo_uint ublobsize = 0; |
123 |
lzo_uint ublobsize = 0; |
124 |
int rc = lzo1x_decompress(blob, blobsize, ublob, &ublobsize, NULL); |
124 |
int rc = lzo1x_decompress(blob, blobsize, ublob, &ublobsize, NULL); |
125 |
if (rc != LZO_E_OK || ublobsize < 1 || ublobsize > hdrsize_max) { |
125 |
if (rc != LZO_E_OK || ublobsize < 1 || ublobsize > hdrsize_max) { |
Lines 127-140
Header hdrcache_get(const char *path, const struct stat *st, unsigned *off)
Link Here
|
127 |
return NULL; |
127 |
return NULL; |
128 |
} |
128 |
} |
129 |
blob = ublob; |
129 |
blob = ublob; |
|
|
130 |
blobsize = ublobsize; |
130 |
} |
131 |
} |
131 |
Header h = headerLoad(blob); |
132 |
Header h = headerCopyLoad(blob); |
132 |
if (h == NULL) { |
133 |
if (h == NULL) { |
133 |
fprintf(stderr, "%s %s: headerLoad failed\n", __func__, key); |
134 |
fprintf(stderr, "%s %s: headerLoad failed\n", __func__, key); |
134 |
return NULL; |
135 |
return NULL; |
135 |
} |
136 |
} |
136 |
if (off) |
137 |
if (off) |
137 |
*off = data->off; |
138 |
*off = data->off; |
|
|
139 |
free(data); |
138 |
return h; |
140 |
return h; |
139 |
} |
141 |
} |
140 |
|
142 |
|