Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 794549 Details for
Bug 861209
www-apps/cgit: Truncated output
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
sendfile patch
sendfile.patch (text/plain), 1.55 KB, created by
Marcin Deranek
on 2022-07-26 10:10:50 UTC
(
hide
)
Description:
sendfile patch
Filename:
MIME Type:
Creator:
Marcin Deranek
Created:
2022-07-26 10:10:50 UTC
Size:
1.55 KB
patch
obsolete
>--- cgit-1.2.3/cache.c 2020-03-14 00:49:52.000000000 +0100 >+++ cgit-1.2.3/cache.c 2022-07-26 11:50:17.802432310 +0200 >@@ -85,40 +85,42 @@ > /* 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; >+ off_t off; >+ ssize_t i; >+ >+ off = slot->keylen + 1; > >- start_off = slot->keylen + 1; >+#ifdef HAVE_LINUX_SENDFILE >+ off_t size; >+ size = slot->cache_st.st_size; > > do { >- ret = sendfile(STDOUT_FILENO, slot->cache_fd, &start_off, >- slot->cache_st.st_size - start_off); >- if (ret < 0) { >+ i = sendfile(STDOUT_FILENO, slot->cache_fd, &off, size - off); >+ if (i < 0) { > if (errno == EAGAIN || errno == EINTR) > continue; >+ /* Fall back to read/write on EINVAL */ >+ if (errno == EINVAL) >+ break; > return errno; > } >- return 0; >+ if (off == size) >+ return 0; > } while (1); >-#else >- ssize_t i, j; >+#endif > >- i = lseek(slot->cache_fd, slot->keylen + 1, SEEK_SET); >- if (i != slot->keylen + 1) >+ if (lseek(slot->cache_fd, off, SEEK_SET) != off) > return errno; > > do { >- i = j = xread(slot->cache_fd, slot->buf, sizeof(slot->buf)); >- if (i > 0) >- j = xwrite(STDOUT_FILENO, slot->buf, i); >- } while (i > 0 && j == i); >- >- if (i < 0 || j != i) >- return errno; >- else >- return 0; >-#endif >+ i = xread(slot->cache_fd, slot->buf, sizeof(slot->buf)); >+ if (i < 0) >+ return errno; >+ if (i == 0) >+ return 0; >+ if (write_in_full(STDOUT_FILENO, slot->buf, i) < 0) >+ return errno; >+ } while (1); > } > > /* Check if the slot has expired */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 861209
: 794549