netkit-ftp (0.17-27) 060_full_offset_range.diff

Summary

 ftp/ftp.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

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));