Package: netkit-ftp-ssl / 0.17.34+0.2-4

060_full_offset_range.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Description: Use full offset range.
 On 32-bit systems, the coding of offset values
 as `off_t', i.e., of 64 bit length, was incomplete.
 Replacing fseek() with fseeko() achieves the intended
 offset ranges.
Bug-Debian: http://bugs.debian.org/671873
Forwarded: not-needed
Author: Mats Erik Andersson, Martin Hicks
Last-Update: 2012-05-23

--- netkit-ftp-0.17.debian/ftp/ftp.c
+++ netkit-ftp-0.17/ftp/ftp.c
@@ -720,7 +720,7 @@ sendrequest(const char *cmd, char *local
 
 	if (restart_point &&
 	    (strcmp(cmd, "STOR") == 0 || strcmp(cmd, "APPE") == 0)) {
-		if (fseek(fin, restart_point, 0) < 0) {
+		if (fseeko(fin, restart_point, SEEK_SET) < 0) {
 			fprintf(stderr, "local: %s: %s\n", local,
 				strerror(errno));
 			restart_point = 0;
@@ -1095,7 +1095,7 @@ recvrequest(const char *cmd,
 	case TYPE_I:
 	case TYPE_L:
 		if (restart_point &&
-		    lseek(fileno(fout), restart_point, L_SET) < 0) {
+		    lseek(fileno(fout), restart_point, SEEK_SET) < 0) {
 			fprintf(stderr, "local: %s: %s\n", local,
 				strerror(errno));
 			if (closefunc != NULL) {
@@ -1149,9 +1149,10 @@ recvrequest(const char *cmd,
 
 	case TYPE_A:
 		if (restart_point) {
-			register int i, n, ch;
+			register off_t i, n;
+			register int ch;
 
-			if (fseek(fout, 0L, L_SET) < 0)
+			if (fseeko(fout, 0L, SEEK_SET) < 0)
 				goto done;
 			n = restart_point;
 			for (i = 0; i++ < n;) {
@@ -1160,7 +1161,7 @@ recvrequest(const char *cmd,
 				if (ch == '\n')
 					i++;
 			}
-			if (fseek(fout, 0L, L_INCR) < 0) {
+			if (fseeko(fout, 0L, SEEK_CUR) < 0) {
 done:
 				fprintf(stderr, "local: %s: %s\n", local,
 					strerror(errno));