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

(-)Makefile (-18 / +15 lines)
Lines 2-19 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	motion
4
PORTNAME=	motion
5
PORTVERSION=	4.0.1
5
PORTVERSION=	4.3.0
6
DISTVERSIONPREFIX=	release-
6
DISTVERSIONPREFIX=	Release-
7
PORTREVISION=	10
7
PORTREVISION=	1
8
CATEGORIES=	multimedia
8
CATEGORIES=	multimedia
9
9
10
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	ports@blievers.net
11
COMMENT=	Motion detection application
11
COMMENT=	Motion detection application
12
12
13
LICENSE=	GPLv2+
13
LICENSE=	GPLv2+
14
LICENSE_FILE=	${WRKSRC}/COPYING
14
LICENSE_FILE=	${WRKSRC}/doc/COPYING
15
15
16
USES=		autoreconf gmake jpeg localbase pkgconfig
16
USES=		autoreconf gmake jpeg localbase pkgconfig gettext-runtime
17
LIB_DEPENDS=	libmicrohttpd.so:www/libmicrohttpd
17
USE_GITHUB=	yes
18
USE_GITHUB=	yes
18
GH_ACCOUNT=	Motion-Project
19
GH_ACCOUNT=	Motion-Project
19
USE_RC_SUBR=	${PORTNAME}
20
USE_RC_SUBR=	${PORTNAME}
Lines 33-41 Link Here
33
		man/man1/motion.1.gz \
34
		man/man1/motion.1.gz \
34
		"@sample ${ETCDIR}/motion.conf.sample" \
35
		"@sample ${ETCDIR}/motion.conf.sample" \
35
		"@dir ${ETCDIR}/conf.d"
36
		"@dir ${ETCDIR}/conf.d"
36
PORTDOCS=	CHANGELOG CREDITS README.md README.FreeBSD \
37
PORTDOCS=	doc/* README.md
37
		motion_guide.html mask1.png normal.jpg \
38
38
		outputmotion1.jpg outputnormal1.jpg
39
PORTEXAMPLES=	camera1-dist.conf camera2-dist.conf \
39
PORTEXAMPLES=	camera1-dist.conf camera2-dist.conf \
40
		camera3-dist.conf camera4-dist.conf
40
		camera3-dist.conf camera4-dist.conf
41
41
Lines 86-109 Link Here
86
		's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/configure.ac
86
		's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/configure.ac
87
# Fix pidfile path
87
# Fix pidfile path
88
	@${REINPLACE_CMD} -e \
88
	@${REINPLACE_CMD} -e \
89
		's|/run/motion|/run|' ${WRKSRC}/motion-dist.conf.in
89
		's|/run/motion|/run|' ${WRKSRC}/data/motion-dist.conf.in
90
# Fix warnings about mismatched format specifiers (Fixed upstream in dbd7282)
91
	@${REINPLACE_CMD} -e \
92
		's|%hd|%d|g;s|%hu|%u|g;s|%Zu|%zu|g' ${WRKSRC}/webhttpd.c ${WRKSRC}/stream.c
93
90
94
do-install:
91
do-install:
95
	${INSTALL_PROGRAM} ${WRKSRC}/motion ${STAGEDIR}${PREFIX}/bin
92
	${INSTALL_PROGRAM} ${WRKSRC}/src/motion ${STAGEDIR}${PREFIX}/bin
96
	${INSTALL_MAN} ${WRKSRC}/motion.1 ${STAGEDIR}${MANPREFIX}/man/man1
93
	${INSTALL_MAN} ${WRKSRC}/man/motion.1 ${STAGEDIR}${MANPREFIX}/man/man1
97
	@${MKDIR} ${STAGEDIR}${ETCDIR}/conf.d
94
	@${MKDIR} ${STAGEDIR}${ETCDIR}/conf.d
98
	${INSTALL_DATA} ${WRKSRC}/motion-dist.conf \
95
	${INSTALL_DATA} ${WRKSRC}/data/motion-dist.conf \
99
		${STAGEDIR}${ETCDIR}/motion.conf.sample
96
		${STAGEDIR}${ETCDIR}/motion.conf.sample
100
97
101
do-install-DOCS-on:
98
do-install-DOCS-on:
102
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
99
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
103
	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
100
	${INSTALL_MAN} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
104
101
105
do-install-EXAMPLES-on:
102
do-install-EXAMPLES-on:
106
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
103
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
107
	${INSTALL_DATA} ${PORTEXAMPLES:S|^|${WRKSRC}/|} ${STAGEDIR}${EXAMPLESDIR}
104
	${INSTALL_DATA} ${PORTEXAMPLES:S|^|${WRKSRC}/data/|} ${STAGEDIR}${EXAMPLESDIR}
108
105
109
.include <bsd.port.post.mk>
106
.include <bsd.port.post.mk>
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1481857527
1
TIMESTAMP = 1579243956
2
SHA256 (Motion-Project-motion-release-4.0.1_GH0.tar.gz) = 2f67669a09ce0481ecd987028dae1c5cb135dfdc3c254c06ab7c9ca0c6c183f0
2
SHA256 (Motion-Project-motion-Release-4.3.0_GH0.tar.gz) = 711c0281605a939e440eafafc16c45a04d4ca5077346af884b2ad30dcfe71ffa
3
SIZE (Motion-Project-motion-release-4.0.1_GH0.tar.gz) = 444779
3
SIZE (Motion-Project-motion-Release-4.3.0_GH0.tar.gz) = 849564
(-)files/patch-conf.c (-254 lines)
Lines 1-254 Link Here
1
Convert old GNU field designator syntax to C99 syntax to remove some
2
annoying warnings. Fixed upstream in a870946, mostly.
3
4
--- conf.c.orig	2016-10-25 01:39:24 UTC
5
+++ conf.c
6
@@ -49,131 +49,131 @@ char *get_current_dir_name(void)
7
 #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0; }
8
 
9
 struct config conf_template = {
10
-    camera_name:                    NULL,
11
-    width:                          DEF_WIDTH,
12
-    height:                         DEF_HEIGHT,
13
-    quality:                        DEF_QUALITY,
14
-    camera_id:                      0,
15
-    rotate_deg:                     0,
16
-    max_changes:                    DEF_CHANGES,
17
-    threshold_tune:                 0,
18
-    output_pictures:                "on",
19
-    motion_img:                     0,
20
-    emulate_motion:                 0,
21
-    event_gap:                      DEF_EVENT_GAP,
22
-    max_movie_time:                 DEF_MAXMOVIETIME,
23
-    snapshot_interval:              0,
24
-    locate_motion_mode:             "off",
25
-    locate_motion_style:            "box",
26
-    input:                          IN_DEFAULT,
27
-    norm:                           0,
28
-    frame_limit:                    DEF_MAXFRAMERATE,
29
-    quiet:                          1,
30
-    picture_type:                   "jpeg",
31
-    noise:                          DEF_NOISELEVEL,
32
-    noise_tune:                     1,
33
-    minimum_frame_time:             0,
34
-    lightswitch:                    0,
35
-    autobright:                     0,
36
-    brightness:                     0,
37
-    contrast:                       0,
38
-    saturation:                     0,
39
-    hue:                            0,
40
-    power_line_frequency:           -1,
41
-    roundrobin_frames:              1,
42
-    roundrobin_skip:                1,
43
-    pre_capture:                    0,
44
-    post_capture:                   0,
45
-    switchfilter:                   0,
46
-    ffmpeg_output:                  0,
47
-    extpipe:                        NULL,
48
-    useextpipe:                     0,
49
-    ffmpeg_output_debug:            0,
50
-    ffmpeg_bps:                     DEF_FFMPEG_BPS,
51
-    ffmpeg_vbr:                     DEF_FFMPEG_VBR,
52
-    ffmpeg_video_codec:             DEF_FFMPEG_CODEC,
53
+    .camera_name =                   NULL,
54
+    .width =                         DEF_WIDTH,
55
+    .height =                        DEF_HEIGHT,
56
+    .quality =                       DEF_QUALITY,
57
+    .camera_id =                     0,
58
+    .rotate_deg =                    0,
59
+    .max_changes =                   DEF_CHANGES,
60
+    .threshold_tune =                0,
61
+    .output_pictures =               "on",
62
+    .motion_img =                    0,
63
+    .emulate_motion =                0,
64
+    .event_gap =                     DEF_EVENT_GAP,
65
+    .max_movie_time =                DEF_MAXMOVIETIME,
66
+    .snapshot_interval =             0,
67
+    .locate_motion_mode =            "off",
68
+    .locate_motion_style =           "box",
69
+    .input =                         IN_DEFAULT,
70
+    .norm =                          0,
71
+    .frame_limit =                   DEF_MAXFRAMERATE,
72
+    .quiet =                         1,
73
+    .picture_type =                  "jpeg",
74
+    .noise =                         DEF_NOISELEVEL,
75
+    .noise_tune =                    1,
76
+    .minimum_frame_time =            0,
77
+    .lightswitch =                   0,
78
+    .autobright =                    0,
79
+    .brightness =                    0,
80
+    .contrast =                      0,
81
+    .saturation =                    0,
82
+    .hue =                           0,
83
+    .power_line_frequency =          -1,
84
+    .roundrobin_frames =             1,
85
+    .roundrobin_skip =               1,
86
+    .pre_capture =                   0,
87
+    .post_capture =                  0,
88
+    .switchfilter =                  0,
89
+    .ffmpeg_output =                 0,
90
+    .extpipe =                       NULL,
91
+    .useextpipe =                    0,
92
+    .ffmpeg_output_debug =           0,
93
+    .ffmpeg_bps =                    DEF_FFMPEG_BPS,
94
+    .ffmpeg_vbr =                    DEF_FFMPEG_VBR,
95
+    .ffmpeg_video_codec =            DEF_FFMPEG_CODEC,
96
 #ifdef HAVE_SDL
97
-    sdl_threadnr:                   0,
98
+    .sdl_threadnr =                  0,
99
 #endif
100
-    ipv6_enabled:                   0,
101
-    stream_port:                    0,
102
-    stream_quality:                 50,
103
-    stream_motion:                  0,
104
-    stream_maxrate:                 1,
105
-    stream_localhost:               1,
106
-    stream_limit:                   0,
107
-    stream_auth_method:             0,
108
-    stream_authentication:          NULL,
109
-    stream_preview_scale:           25,
110
-    stream_preview_newline:         0,
111
-    webcontrol_port:                0,
112
-    webcontrol_localhost:           1,
113
-    webcontrol_html_output:         1,
114
-    webcontrol_authentication:      NULL,
115
-    frequency:                      0,
116
-    tuner_number:                   0,
117
-    timelapse:                      0,
118
-    timelapse_mode:                 DEF_TIMELAPSE_MODE,
119
+    .ipv6_enabled =                  0,
120
+    .stream_port =                   0,
121
+    .stream_quality =                50,
122
+    .stream_motion =                 0,
123
+    .stream_maxrate =                1,
124
+    .stream_localhost =              1,
125
+    .stream_limit =                  0,
126
+    .stream_auth_method =            0,
127
+    .stream_authentication =         NULL,
128
+    .stream_preview_scale =          25,
129
+    .stream_preview_newline =        0,
130
+    .webcontrol_port =               0,
131
+    .webcontrol_localhost =          1,
132
+    .webcontrol_html_output =        1,
133
+    .webcontrol_authentication =     NULL,
134
+    .frequency =                     0,
135
+    .tuner_number =                  0,
136
+    .timelapse =                     0,
137
+    .timelapse_mode =                DEF_TIMELAPSE_MODE,
138
 #if (defined(BSD))
139
-    tuner_device:                   NULL,
140
+    .tuner_device =                  NULL,
141
 #endif
142
-    video_device:                   VIDEO_DEVICE,
143
-    v4l2_palette:                   DEF_PALETTE,
144
-    vidpipe:                        NULL,
145
-    filepath:                       NULL,
146
-    imagepath:                      DEF_IMAGEPATH,
147
-    moviepath:                      DEF_MOVIEPATH,
148
-    snappath:                       DEF_SNAPPATH,
149
-    timepath:                       DEF_TIMEPATH,
150
-    on_event_start:                 NULL,
151
-    on_event_end:                   NULL,
152
-    mask_file:                      NULL,
153
-    smart_mask_speed:               0,
154
+    .video_device =                  VIDEO_DEVICE,
155
+    .v4l2_palette =                  DEF_PALETTE,
156
+    .vidpipe =                       NULL,
157
+    .filepath =                      NULL,
158
+    .imagepath =                     DEF_IMAGEPATH,
159
+    .moviepath =                     DEF_MOVIEPATH,
160
+    .snappath =                      DEF_SNAPPATH,
161
+    .timepath =                      DEF_TIMEPATH,
162
+    .on_event_start =                NULL,
163
+    .on_event_end =                  NULL,
164
+    .mask_file =                     NULL,
165
+    .smart_mask_speed =              0,
166
 #if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3)
167
-    sql_log_image:                  1,
168
-    sql_log_snapshot:               1,
169
-    sql_log_movie:                  0,
170
-    sql_log_timelapse:              0,
171
-    sql_query:                      DEF_SQL_QUERY,
172
-    database_type:                  NULL,
173
-    database_dbname:                NULL,
174
-    database_host:                  "localhost",
175
-    database_user:                  NULL,
176
-    database_password:              NULL,
177
-    database_port:                  0,
178
-    database_busy_timeout:           0,
179
+    .sql_log_image =                 1,
180
+    .sql_log_snapshot =              1,
181
+    .sql_log_movie =                 0,
182
+    .sql_log_timelapse =             0,
183
+    .sql_query =                     DEF_SQL_QUERY,
184
+    .database_type =                 NULL,
185
+    .database_dbname =               NULL,
186
+    .database_host =                 "localhost",
187
+    .database_user =                 NULL,
188
+    .database_password =             NULL,
189
+    .database_port =                 0,
190
+    .database_busy_timeout =          0,
191
 #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || define(HAVE_SQLITE3) */
192
-    on_picture_save:                NULL,
193
-    on_motion_detected:             NULL,
194
-    on_area_detected:               NULL,
195
-    on_movie_start:                 NULL,
196
-    on_movie_end:                   NULL,
197
-    on_camera_lost:                 NULL,
198
-    motionvidpipe:                  NULL,
199
-    netcam_url:                     NULL,
200
-    netcam_userpass:                NULL,
201
-    netcam_keepalive:               "off",
202
-    netcam_proxy:                   NULL,
203
-    netcam_tolerant_check:          0,
204
-    rtsp_uses_tcp:                  1,
205
+    .on_picture_save =               NULL,
206
+    .on_motion_detected =            NULL,
207
+    .on_area_detected =              NULL,
208
+    .on_movie_start =                NULL,
209
+    .on_movie_end =                  NULL,
210
+    .on_camera_lost =                NULL,
211
+    .motionvidpipe =                 NULL,
212
+    .netcam_url =                    NULL,
213
+    .netcam_userpass =               NULL,
214
+    .netcam_keepalive =              "off",
215
+    .netcam_proxy =                  NULL,
216
+    .netcam_tolerant_check =         0,
217
+    .rtsp_uses_tcp =                 1,
218
 #ifdef HAVE_MMAL
219
-    mmalcam_name:                   NULL,
220
-    mmalcam_control_params:         NULL,
221
+    .mmalcam_name =                  NULL,
222
+    .mmalcam_control_params =        NULL,
223
 #endif
224
-    text_changes:                   0,
225
-    text_left:                      NULL,
226
-    text_right:                     DEF_TIMESTAMP,
227
-    text_event:                     DEF_EVENTSTAMP,
228
-    text_double:                    0,
229
-    despeckle_filter:               NULL,
230
-    area_detect:                    NULL,
231
-    minimum_motion_frames:          1,
232
-    exif_text:                      NULL,
233
-    pid_file:                       NULL,
234
-    log_file:                       NULL,
235
-    log_level:                      LEVEL_DEFAULT+10,
236
-    log_type_str:                   NULL,
237
-    camera_dir:                     sysconfdir"/conf.d"
238
+    .text_changes =                  0,
239
+    .text_left =                     NULL,
240
+    .text_right =                    DEF_TIMESTAMP,
241
+    .text_event =                    DEF_EVENTSTAMP,
242
+    .text_double =                   0,
243
+    .despeckle_filter =              NULL,
244
+    .area_detect =                   NULL,
245
+    .minimum_motion_frames =         1,
246
+    .exif_text =                     NULL,
247
+    .pid_file =                      NULL,
248
+    .log_file =                      NULL,
249
+    .log_level =                     LEVEL_DEFAULT+10,
250
+    .log_type_str =                  NULL,
251
+    .camera_dir =                    sysconfdir"/conf.d"
252
 };
253
 
254
 
(-)files/patch-configure.ac (-11 lines)
Lines 1-11 Link Here
1
--- configure.ac.orig	2016-10-25 01:39:24 UTC
2
+++ configure.ac
3
@@ -790,7 +790,7 @@ SUPPORTED_V4L2_old=false
4
 if test "${V4L}" = "no"; then
5
 	AC_MSG_CHECKING(for V42L support)
6
 	AC_MSG_RESULT(skipping)
7
-else
8
+elif test "${PWCBSD}" = "yes"; then
9
 	AC_CHECK_TYPE([struct v4l2_buffer],
10
 		[SUPPORTED_V4L2=true],
11
 		[SUPPORTED_V4L2=false],
(-)files/patch-ffmpeg.c (-53 lines)
Lines 1-53 Link Here
1
Upstream fix from 4.1.* causes too many merge conflicts.
2
https://github.com/Motion-Project/motion/commit/b5c3a73cc62e
3
https://github.com/Motion-Project/motion/commit/9b93a417e37e
4
5
--- ffmpeg.c.orig	2016-10-25 01:39:24 UTC
6
+++ ffmpeg.c
7
@@ -439,7 +439,7 @@ struct ffmpeg *ffmpeg_open(const char *ffmpeg_video_co
8
         /* The selection of 8000 in the else is a subjective number based upon viewing output files */
9
         if (vbr > 0){
10
             ffmpeg->vbr =(int)(((100-vbr)*(100-vbr)*(100-vbr) * 8000) / 1000000) + 1;
11
-            c->flags |= CODEC_FLAG_QSCALE;
12
+            c->flags |= AV_CODEC_FLAG_QSCALE;
13
             c->global_quality=ffmpeg->vbr;
14
         }
15
     }
16
@@ -447,7 +447,7 @@ struct ffmpeg *ffmpeg_open(const char *ffmpeg_video_co
17
     MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, "%s vbr/crf for codec: %d", ffmpeg->vbr);
18
 
19
     if (strcmp(ffmpeg_video_codec, "ffv1") == 0) c->strict_std_compliance = -2;
20
-    c->flags |= CODEC_FLAG_GLOBAL_HEADER;
21
+    c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
22
 
23
     retcd = avcodec_open2(c, codec, &opts);
24
     if (retcd < 0) {
25
@@ -489,7 +489,10 @@ struct ffmpeg *ffmpeg_open(const char *ffmpeg_video_co
26
     }
27
 
28
     ffmpeg->video_outbuf = NULL;
29
-    if (!(ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE)) {
30
+#ifdef AVFMT_RAWPICTURE
31
+    if (!(ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE))
32
+#endif
33
+    {
34
         ffmpeg->video_outbuf_size = ffmpeg->c->width * 512;
35
         ffmpeg->video_outbuf = mymalloc(ffmpeg->video_outbuf_size);
36
     }
37
@@ -705,12 +708,15 @@ int ffmpeg_put_frame(struct ffmpeg *ffmpeg, AVFrame *p
38
     gettimeofday(&tv1, NULL);
39
 
40
     av_init_packet(&pkt); /* Init static structure. */
41
+#ifdef AVFMT_RAWPICTURE
42
     if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) {
43
         pkt.stream_index = ffmpeg->video_st->index;
44
         pkt.flags |= AV_PKT_FLAG_KEY;
45
         pkt.data = (uint8_t *)pic;
46
         pkt.size = sizeof(AVPicture);
47
-    } else {
48
+    } else
49
+#endif
50
+    {
51
         pkt.data = NULL;
52
         pkt.size = 0;
53
         retcd = avcodec_encode_video2(AVSTREAM_CODEC_PTR(ffmpeg->video_st),
(-)files/patch-netcam.c (-57 lines)
Lines 1-57 Link Here
1
Fix netcam getaddrinfo/connect usage (Fixed upstream in be2328a)
2
3
--- netcam.c.orig	2016-10-25 01:39:24 UTC
4
+++ netcam.c
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
46
     }
47
 
48
     /* Now the connect call will return immediately. */
49
-    ret = connect(netcam->sock, &server, sizeof(server));
50
+    ret = connect(netcam->sock, ai->ai_addr, ai->ai_addrlen);
51
     back_err = errno;           /* Save the errno from connect */
52
 
53
+    freeaddrinfo(ai);
54
+
55
     /* If the connect failed with anything except EINPROGRESS, error. */
56
     if ((ret < 0) && (back_err != EINPROGRESS)) {
57
         if (!err_flag)
(-)files/patch-stream.c (-32 lines)
Lines 1-32 Link Here
1
--- stream.c.orig	2016-10-25 01:39:24 UTC
2
+++ stream.c
3
@@ -727,9 +727,9 @@ int http_bindsock(int port, int local, i
4
     const char *addr_str;
5
     struct sockaddr_storage sin;
6
     bzero(&sin, sizeof(struct sockaddr_storage));
7
-    sin.ss_family = ipv6_enabled?AF_INET6:AF_INET;
8
     if (ipv6_enabled) {
9
         struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)&sin;
10
+        sin6->sin6_len = sizeof(struct sockaddr_in6);
11
         sin6->sin6_family = AF_INET6;
12
         sin6->sin6_port = htons(port);
13
         if(local) {
14
@@ -741,6 +741,7 @@ int http_bindsock(int port, int local, i
15
         }
16
     } else {
17
         struct sockaddr_in *sin4 = (struct sockaddr_in*)&sin;
18
+        sin4->sin_len = sizeof(struct sockaddr_in);
19
         sin4->sin_family = AF_INET;
20
         sin4->sin_port = htons(port);
21
         if(local) {
22
@@ -752,8 +753,8 @@ int http_bindsock(int port, int local, i
23
         }
24
     }
25
 
26
-    if (bind(sd, (struct sockaddr*)&sin, sizeof(sin)) != 0) {
27
-        MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, "%s: error binding on %s port %d", addr_str, port);
28
+    if (bind(sd, (struct sockaddr*)&sin, sin.ss_len) != 0) {
29
+        MOTION_LOG(NTC, TYPE_STREAM, SHOW_ERRNO, "%s: error binding on %s port %d", addr_str, port);
30
         close(sd);
31
         return -1;
32
     }
(-)files/patch-track.c (-50 lines)
Lines 1-50 Link Here
1
Convert old GNU field designator syntax to C99 syntax to remove some
2
annoying warnings. Fixed upstream in a870946.
3
4
--- track.c.orig	2016-10-25 01:39:24 UTC
5
+++ track.c
6
@@ -17,25 +17,25 @@
7
 
8
 
9
 struct trackoptions track_template = {
10
-    dev:            -1,             /* dev open */
11
-    port:           NULL,           /* char *port */
12
-    motorx:         0,              /* int motorx */
13
-    motory:         0,              /* int motory */
14
-    maxx:           0,              /* int maxx; */
15
-    maxy:           0,              /* int maxy; */
16
-    minx:           0,              /* int minx; */
17
-    miny:           0,              /* int miny; */
18
-    homex:          128,            /* int homex; */
19
-    homey:          128,            /* int homey; */
20
-    motorx_reverse: 0,              /* int reversed x servo; */
21
-    motory_reverse: 0,              /* int reversed y servo; */
22
-    speed:          TRACK_SPEED,    /* speed */
23
-    stepsize:       TRACK_STEPSIZE, /* stepsize */
24
-    active:         0,              /* auto tracking active */
25
-    minmaxfound:    0,              /* flag for minmax values stored for pwc based camera */
26
-    step_angle_x:   10,             /* UVC step angle in degrees X-axis that camera moves during auto tracking */
27
-    step_angle_y:   10,             /* UVC step angle in degrees Y-axis that camera moves during auto tracking */
28
-    move_wait:      10              /* number of frames to disable motion detection after camera moving */
29
+    .dev =            -1,             /* dev open */
30
+    .port =           NULL,           /* char *port */
31
+    .motorx =         0,              /* int motorx */
32
+    .motory =         0,              /* int motory */
33
+    .maxx =           0,              /* int maxx; */
34
+    .maxy =           0,              /* int maxy; */
35
+    .minx =           0,              /* int minx; */
36
+    .miny =           0,              /* int miny; */
37
+    .homex =          128,            /* int homex; */
38
+    .homey =          128,            /* int homey; */
39
+    .motorx_reverse = 0,              /* int reversed x servo; */
40
+    .motory_reverse = 0,              /* int reversed y servo; */
41
+    .speed =          TRACK_SPEED,    /* speed */
42
+    .stepsize =       TRACK_STEPSIZE, /* stepsize */
43
+    .active =         0,              /* auto tracking active */
44
+    .minmaxfound =    0,              /* flag for minmax values stored for pwc based camera */
45
+    .step_angle_x =   10,             /* UVC step angle in degrees X-axis that camera moves during auto tracking */
46
+    .step_angle_y =   10,             /* UVC step angle in degrees Y-axis that camera moves during auto tracking */
47
+    .move_wait =      10              /* number of frames to disable motion detection after camera moving */
48
 };
49
 
50
 
(-)files/patch-video2.c (-11 lines)
Lines 1-11 Link Here
1
--- video2.c.orig	2017-08-11 20:05:27 UTC
2
+++ video2.c
3
@@ -184,7 +184,7 @@ typedef struct {
4
 /**
5
  * xioctl
6
  */
7
-#ifdef __OpenBSD__
8
+#if defined (__OpenBSD__) || defined (__FreeBSD__)
9
 static int xioctl(src_v4l2_t *vid_source, unsigned long request, void *arg)
10
 #else
11
 static int xioctl(src_v4l2_t *vid_source, int request, void *arg)
(-)files/patch-video__freebsd.c (-20 lines)
Lines 1-20 Link Here
1
Comment out unused struct to avoid warnings.
2
3
--- video_freebsd.c.orig	2016-10-25 01:39:24 UTC
4
+++ video_freebsd.c
5
@@ -41,6 +41,7 @@
6
 
7
 #define array_elem(x) (sizeof(x) / sizeof((x)[0]))
8
 
9
+/*
10
 static const struct camparam_st {
11
   int min, max, range, drv_min, drv_range, def;
12
 } CamParams[] = {
13
@@ -58,6 +59,7 @@ static const struct camparam_st {
14
     BT848_CHROMAREGMIN, (BT848_CHROMAREGMAX - BT848_CHROMAREGMIN + 1),
15
     BT848_CHROMACENTER, },
16
 };
17
+*/
18
 
19
 #define BRIGHT 0
20
 #define CONTR  1
(-)files/patch-webhttpd.c (-45 lines)
Lines 1-45 Link Here
1
Fix warnings about mismatched format specifiers (Fixed upstream in dbd7282)
2
Fix sockaddr type mismatch warnings (Fixed upstream in dbd7282)
3
4
--- webhttpd.c.orig	2016-10-25 01:39:24 UTC
5
+++ webhttpd.c
6
@@ -2067,7 +2067,7 @@ static unsigned int handle_get(int clien
7
             //Send the webcontrol section if applicable
8
             if (cnt[0]->conf.webcontrol_html_output) {
9
                 send_template_ini_client(client_socket, ini_template);
10
-                sprintf(res, "<b>Motion "VERSION" Running [%hu] Cameras</b><br>\n"
11
+                sprintf(res, "<b>Motion "VERSION" Running [%d] Cameras</b><br>\n"
12
                              "<a href='/0/'>All</a>\n", i);
13
                 send_template(client_socket, res);
14
 
15
@@ -2079,7 +2079,7 @@ static unsigned int handle_get(int clien
16
                         send_template(client_socket, res);
17
                         counter = 0;
18
                     }
19
-                    sprintf(res, "<a href='/%hu/'>Camera %d%s%s</a>\n", y, cnt[y]->conf.camera_id,
20
+                    sprintf(res, "<a href='/%d/'>Camera %d%s%s</a>\n", y, cnt[y]->conf.camera_id,
21
                                  cnt[y]->conf.camera_name ? " -- " : "",
22
                                  cnt[y]->conf.camera_name ? cnt[y]->conf.camera_name : "");
23
                     send_template(client_socket, res);
24
@@ -2112,10 +2112,10 @@ static unsigned int handle_get(int clien
25
                 send_template_end_client(client_socket);
26
             } else {
27
                 send_template_ini_client_raw(client_socket);
28
-                sprintf(res, "Motion "VERSION" Running [%hu] Cameras\n0\n", i);
29
+                sprintf(res, "Motion "VERSION" Running [%d] Cameras\n0\n", i);
30
                 send_template_raw(client_socket, res);
31
                 for (y = 1; y < i; y++) {
32
-                    sprintf(res, "%hu\n", y);
33
+                    sprintf(res, "%d\n", y);
34
                     send_template_raw(client_socket, res);
35
                 }
36
             }
37
@@ -2571,7 +2571,7 @@ static int acceptnonblocking(int serverf
38
 
39
     if (select(serverfd + 1, &fds, NULL, NULL, &tm) > 0) {
40
         if (FD_ISSET(serverfd, &fds)) {
41
-            if ((curfd = accept(serverfd, &client, &client_len)) > 0)
42
+            if ((curfd = accept(serverfd, (struct sockaddr *)&client, &client_len)) > 0)
43
                 return curfd;
44
         }
45
     }

Return to bug 243415