| Server IP : 82.208.35.60 / Your IP : 216.73.216.168 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/mail/mailutils/files/ |
Upload File : |
--- libmailutils/stream/rdcache_stream.c.orig 2022-02-12 15:20:43 UTC
+++ libmailutils/stream/rdcache_stream.c
@@ -21,10 +21,9 @@
#include <stdlib.h>
#include <errno.h>
#include <mailutils/types.h>
+#include <mailutils/errno.h>
#include <mailutils/sys/rdcache_stream.h>
-size_t mu_rdcache_stream_max_memory_size = 4096;
-
static int
rdcache_read (struct _mu_stream *str, char *buf, size_t size, size_t *pnbytes)
{
@@ -38,7 +37,6 @@ rdcache_read (struct _mu_stream *str, char *buf, size_
if (status)
return status;
sp->offset += nbytes;
- sp->size += nbytes;
buf += nbytes;
size -= nbytes;
}
@@ -79,11 +77,29 @@ static int
}
static int
-rdcache_size (struct _mu_stream *str, off_t *psize)
+rdcache_size (struct _mu_stream *str, mu_off_t *psize)
{
struct _mu_rdcache_stream *sp = (struct _mu_rdcache_stream *) str;
- *psize = sp->size;
- return 0;
+ int rc;
+
+ if (mu_stream_eof (sp->transport))
+ {
+ *psize = sp->size;
+ rc = 0;
+ }
+ else
+ {
+ rc = mu_stream_size (sp->transport, psize);
+ switch (rc)
+ {
+ case EAGAIN:
+ case EINTR:
+ case ENOSYS:
+ case EINPROGRESS:
+ rc = MU_ERR_INFO_UNAVAILABLE;
+ }
+ }
+ return rc;
}
static int