]>
Commit | Line | Data |
---|---|---|
7b7692b8 ER |
1 | --- proftpd-1.3.0/include/data.h~ 2006-04-29 14:20:36.776770520 +0300 |
2 | +++ proftpd-1.3.0/include/data.h 2006-04-29 14:21:59.528616003 +0300 | |
7168921b JR |
3 | @@ -36,25 +36,12 @@ |
4 | int pr_data_open(char *, char *, int, off_t); | |
5 | void pr_data_close(int); | |
6 | void pr_data_abort(int, int); | |
7 | -int pr_data_xfer(char *, int); | |
8 | +off_t pr_data_xfer(char *, int); | |
9 | void pr_data_reset(void); | |
10 | void pr_data_set_linger(long); | |
11 | ||
12 | #ifdef HAVE_SENDFILE | |
13 | -typedef | |
14 | - | |
15 | -#if defined(HAVE_AIX_SENDFILE) || defined(HAVE_HPUX_SENDFILE) || \ | |
16 | - defined(HAVE_LINUX_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE) | |
17 | -ssize_t | |
18 | -#elif defined(HAVE_BSD_SENDFILE) | |
19 | -off_t | |
20 | -#else | |
21 | -#error "You have an unknown sendfile implementation." | |
22 | -#endif | |
23 | - | |
24 | -pr_sendfile_t; | |
25 | - | |
7b7692b8 | 26 | -pr_sendfile_t pr_data_sendfile(int retr_fd, off_t *offset, off_t count); |
7168921b JR |
27 | +off_t pr_data_sendfile(int retr_fd, off_t *offset, off_t count); |
28 | #endif /* HAVE_SENDFILE */ | |
29 | ||
30 | #endif /* PR_DATACONN_H */ | |
7168921b JR |
31 | --- proftpd-1.2.10/modules/mod_xfer.c 2004-08-25 00:24:18.000000000 +0200 |
32 | +++ proftpd-1.2.10-sendfile64/modules/mod_xfer.c 2005-02-03 17:18:26.109723112 +0100 | |
33 | @@ -603,7 +603,7 @@ | |
34 | return; | |
35 | } | |
36 | ||
37 | -static int _transmit_normal(char *buf, long bufsize) { | |
38 | +static off_t _transmit_normal(char *buf, long bufsize) { | |
39 | long count; | |
40 | ||
41 | if ((count = pr_fsio_read(retr_fh, buf, bufsize)) <= 0) | |
42 | @@ -614,7 +614,7 @@ | |
43 | ||
44 | #ifdef HAVE_SENDFILE | |
45 | static int _transmit_sendfile(off_t count, off_t *offset, | |
46 | - pr_sendfile_t *retval) { | |
47 | + off_t *retval) { | |
48 | ||
49 | /* We don't use sendfile() if: | |
50 | * - We're using bandwidth throttling. | |
51 | @@ -670,8 +670,8 @@ | |
52 | } | |
53 | #endif /* HAVE_SENDFILE */ | |
54 | ||
55 | -static long _transmit_data(off_t count, off_t offset, char *buf, long bufsize) { | |
56 | - long res; | |
57 | +static off_t _transmit_data(off_t count, off_t offset, char *buf, long bufsize) { | |
58 | + off_t res; | |
59 | ||
60 | #ifdef TCP_CORK | |
61 | int on = 1; | |
62 | @@ -679,7 +679,7 @@ | |
63 | #endif /* TCP_CORK */ | |
64 | ||
65 | #ifdef HAVE_SENDFILE | |
66 | - pr_sendfile_t retval; | |
67 | + off_t retval; | |
68 | #endif /* HAVE_SENDFILE */ | |
69 | ||
70 | #ifdef TCP_CORK | |
71 | @@ -695,7 +695,7 @@ | |
72 | if (!_transmit_sendfile(count, &offset, &retval)) | |
73 | res = _transmit_normal(buf, bufsize); | |
74 | else | |
75 | - res = (long) retval; | |
76 | + res = retval; | |
77 | #else | |
78 | res = _transmit_normal(buf, bufsize); | |
79 | #endif /* HAVE_SENDFILE */ | |
80 | @@ -1526,8 +1526,8 @@ | |
81 | off_t nbytes_max_retrieve = 0; | |
82 | unsigned char have_limit = FALSE; | |
83 | privdata_t *p; | |
84 | - long bufsize, len = 0; | |
85 | - off_t respos = 0, nbytes_sent = 0, cnt_steps = 0, cnt_next = 0; | |
86 | + long bufsize; | |
87 | + off_t respos = 0, nbytes_sent = 0, cnt_steps = 0, cnt_next = 0, len = 0; | |
88 | ||
89 | /* This function sets static module variables for later potential | |
90 | * throttling of the transfer. | |
7168921b JR |
91 | --- proftpd-1.2.10/src/data.c 2004-08-25 20:08:46.000000000 +0200 |
92 | +++ proftpd-1.2.10-sendfile64/src/data.c 2005-02-03 17:20:56.858805768 +0100 | |
93 | @@ -772,9 +772,9 @@ | |
94 | * closes, or -1 if error | |
95 | */ | |
96 | ||
97 | -int pr_data_xfer(char *cl_buf, int cl_size) { | |
98 | - int len = 0; | |
99 | - int total = 0; | |
100 | +off_t pr_data_xfer(char *cl_buf, int cl_size) { | |
101 | + off_t len = 0; | |
102 | + off_t total = 0; | |
103 | ||
104 | if (session.xfer.direction == PR_NETIO_IO_RD) { | |
105 | char *buf = session.xfer.buf; | |
106 | @@ -910,9 +910,9 @@ | |
107 | * ASCII translation is not performed. | |
108 | * return 0 if reading and data connection closes, or -1 if error | |
109 | */ | |
110 | -pr_sendfile_t pr_data_sendfile(int retr_fd, off_t *offset, size_t count) { | |
111 | +off_t pr_data_sendfile(int retr_fd, off_t *offset, off_t count) { | |
112 | int flags, error; | |
113 | - pr_sendfile_t len = 0, total = 0; | |
114 | + off_t len = 0, total = 0; | |
115 | #if defined(HAVE_AIX_SENDFILE) | |
116 | struct sf_parms parms; | |
117 | int rc; | |
118 | @@ -932,14 +932,19 @@ | |
119 | for (;;) { | |
120 | #if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE) | |
121 | off_t orig_offset = *offset; | |
122 | + off_t translen = 0; | |
123 | ||
124 | + if (count > 1024*1024*1024) | |
125 | + translen = 1024*1024*1024; | |
126 | + else | |
127 | + translen = count; | |
128 | /* Linux semantics are fairly straightforward in a glibc 2.x world: | |
129 | * | |
130 | * #include <sys/sendfile.h> | |
131 | * | |
132 | * ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) | |
133 | */ | |
134 | - len = sendfile(PR_NETIO_FD(session.d->outstrm), retr_fd, offset, count); | |
135 | + len = sendfile(PR_NETIO_FD(session.d->outstrm), retr_fd, offset, (size_t)translen); | |
136 | ||
137 | if (len != -1 && len < count) { | |
138 | /* under linux semantics, this occurs when a signal has interrupted |