summaryrefslogtreecommitdiff
path: root/net/xmftp/patches/patch-ac
blob: 9384ae2fd4d34cd3d1c7aea4c7586f83c54eee1d (plain)
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
53
54
55
$NetBSD: patch-ac,v 1.2 2007/12/01 13:39:05 rillig Exp $

--- ftplib/ftplib.c.orig	1997-08-20 21:29:58.000000000 +0200
+++ ftplib/ftplib.c	2007-12-01 14:37:55.000000000 +0100
@@ -25,10 +25,10 @@
 #include "../ui/xmftp.h"
 #include "../ui/operations.h"
 
-#if defined(__unix__)
+#if defined(__unix__) || defined(__NetBSD__)
 #include <unistd.h>
 #endif
-#if defined(__unix__) || defined(VMS)
+#if defined(__unix__) || defined(VMS) || defined(__NetBSD__)
 #define GLOBALDEF
 #define GLOBALREF extern
 #elif defined(_WIN32)
@@ -40,7 +40,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#if defined(__unix__)
+#if defined(__unix__) || defined(__NetBSD__)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -93,7 +93,7 @@ static char *version =
 
 GLOBALDEF int ftplib_debug = 0;
 
-#if defined(__unix__) || defined(VMS)
+#if defined(__unix__) || defined(VMS) || defined(__NetBSD__)
 #define net_read read
 #define net_write write
 #define net_close close
@@ -410,12 +410,13 @@ static int FtpPort(netbuf *nControl)
 	return -1;
     cp++;
     sscanf(cp,"%d,%d,%d,%d,%d,%d",&v[2],&v[3],&v[4],&v[5],&v[0],&v[1]);
-    (unsigned char)sin.sa.sa_data[2] = v[2];
-    (unsigned char)sin.sa.sa_data[3] = v[3];
-    (unsigned char)sin.sa.sa_data[4] = v[4];
-    (unsigned char)sin.sa.sa_data[5] = v[5];
-    (unsigned char)sin.sa.sa_data[0] = v[0];
-    (unsigned char)sin.sa.sa_data[1] = v[1];
+    /* TODO: check that sscanf returns 6 */
+    sin.sa.sa_data[2] = (unsigned char)v[2];
+    sin.sa.sa_data[3] = (unsigned char)v[3];
+    sin.sa.sa_data[4] = (unsigned char)v[4];
+    sin.sa.sa_data[5] = (unsigned char)v[5];
+    sin.sa.sa_data[0] = (unsigned char)v[0];
+    sin.sa.sa_data[1] = (unsigned char)v[1];
     sData = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
     if (sData == -1)
     {