apr_file_t *fd = NULL;
apr_size_t nbytes;
- apr_off_t offset = 0L;
+ apr_off_t offset;
if (er->fd) {
fd = er->fd;
}
else if (er->pathname) {
- apr_file_open(&fd, er->pathname, APR_READ | APR_BINARY, 0, r->pool);
+ if (apr_file_open(&fd, er->pathname, APR_READ | APR_BINARY,
+ 0, r->pool) != APR_SUCCESS) {
+ return "";
+ }
}
if (!fd) {
return "";
etag = apr_palloc(r->pool, weak_len + sizeof("\"\"") +
4*(APR_SHA1_DIGESTSIZE/3) + vlv_len + 4);
+ if (apr_file_seek(fd, APR_CUR, &offset) != APR_SUCCESS) {
+ return "";
+ }
+
apr_sha1_init(&context);
nbytes = sizeof(buf);
while (apr_file_read(fd, buf, &nbytes) == APR_SUCCESS) {