aboutsummaryrefslogtreecommitdiff
path: root/cache.c
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'cache.c')
-rw-r--r--cache.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/cache.c b/cache.c
index 9e7eeb0..fcd461f 100644
--- a/cache.c
+++ b/cache.c
@@ -13,9 +13,6 @@
*
*/
-#ifdef HAVE_LINUX_SENDFILE
-#include <sys/sendfile.h>
-#endif
#include "cgit.h"
#include "cache.h"
#include "html.h"
@@ -33,6 +30,7 @@ struct cache_slot {
const char *lock_name;
int match;
struct stat cache_st;
+ struct stat lock_st;
int bufsize;
char buf[CACHE_BUFSIZE];
};
@@ -83,23 +81,6 @@ static int close_slot(struct cache_slot *slot)
/* Print the content of the active cache slot (but skip the key). */
static int print_slot(struct cache_slot *slot)
{
-#ifdef HAVE_LINUX_SENDFILE
- off_t start_off;
- int ret;
-
- start_off = slot->keylen + 1;
-
- do {
- ret = sendfile(STDOUT_FILENO, slot->cache_fd, &start_off,
- slot->cache_st.st_size - start_off);
- if (ret < 0) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- return errno;
- }
- return 0;
- } while (1);
-#else
ssize_t i, j;
i = lseek(slot->cache_fd, slot->keylen + 1, SEEK_SET);
@@ -116,7 +97,6 @@ static int print_slot(struct cache_slot *slot)
return errno;
else
return 0;
-#endif
}
/* Check if the slot has expired */
@@ -208,10 +188,6 @@ static int fill_slot(struct cache_slot *slot)
/* Generate cache content */
slot->fn();
- /* update stat info */
- if (fstat(slot->lock_fd, &slot->cache_st))
- return errno;
-
/* Restore stdout */
if (dup2(tmp, STDOUT_FILENO) == -1)
return errno;