View | Details | Raw Unified | Return to bug 216189
Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	motion
4
PORTNAME=	motion
5
PORTVERSION=	4.0.1
5
PORTVERSION=	4.0.1
6
PORTREVISION=	1
6
PORTREVISION=	2
7
DISTVERSIONPREFIX=	release-
7
DISTVERSIONPREFIX=	release-
8
CATEGORIES=	multimedia
8
CATEGORIES=	multimedia
9
9
(-)files/patch-netcam.c (-2 / +46 lines)
Lines 2-13 Link Here
2
2
3
--- netcam.c.orig	2016-10-25 01:39:24 UTC
3
--- netcam.c.orig	2016-10-25 01:39:24 UTC
4
+++ netcam.c
4
+++ netcam.c
5
@@ -948,7 +948,7 @@ static int netcam_connect(netcam_context
5
@@ -840,8 +840,7 @@ static void netcam_disconnect(netcam_con
6
  */
7
 static int netcam_connect(netcam_context_ptr netcam, int err_flag)
8
 {
9
-    struct sockaddr_in6 server;      /* For connect */
10
-    struct addrinfo *ai;           /* For getaddrinfo */
11
+    struct addrinfo *ai;
12
     int ret;
13
     int saveflags;
14
     int back_err;
15
@@ -851,8 +850,11 @@ static int netcam_connect(netcam_context
16
     fd_set fd_w;
17
     struct timeval selecttime;
18
 
19
+    char port[15];
20
+    sprintf(port,"%u",netcam->connect_port);
21
+
22
     /* Lookup the hostname given in the netcam URL. */
23
-    if ((ret = getaddrinfo(netcam->connect_host, NULL, NULL, &ai)) != 0) {
24
+    if ((ret = getaddrinfo(netcam->connect_host, port, NULL, &ai)) != 0) {
25
         if (!err_flag)
26
             MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, "%s: getaddrinfo() failed (%s): %s",
27
                        netcam->connect_host, gai_strerror(ret));
28
@@ -920,16 +922,6 @@ static int netcam_connect(netcam_context
29
                netcam->sock);
30
 
31
     /*
32
-     * Fill the hostname details into the 'server' structure and
33
-     * attempt to connect to the remote server.
34
-     */
35
-    memset(&server, 0, sizeof(server));
36
-    memcpy(&server, ai->ai_addr, sizeof(server));
37
-    server.sin6_family = ai->ai_family;
38
-    server.sin6_port = htons(netcam->connect_port);
39
-    freeaddrinfo(ai);
40
-
41
-    /*
42
      * We set the socket non-blocking and then use a 'select'
43
      * system call to control the timeout.
44
      */
45
@@ -948,9 +940,11 @@ static int netcam_connect(netcam_context
6
     }
46
     }
7
 
47
 
8
     /* Now the connect call will return immediately. */
48
     /* Now the connect call will return immediately. */
9
-    ret = connect(netcam->sock, &server, sizeof(server));
49
-    ret = connect(netcam->sock, &server, sizeof(server));
10
+    ret = connect(netcam->sock, (struct sockaddr *)&server, sizeof(server));
50
+    ret = connect(netcam->sock, ai->ai_addr, ai->ai_addrlen);
11
     back_err = errno;           /* Save the errno from connect */
51
     back_err = errno;           /* Save the errno from connect */
12
 
52
 
53
+    freeaddrinfo(ai);
54
+
13
     /* If the connect failed with anything except EINPROGRESS, error. */
55
     /* If the connect failed with anything except EINPROGRESS, error. */
56
     if ((ret < 0) && (back_err != EINPROGRESS)) {
57
         if (!err_flag)

Return to bug 216189