From 0f881050e95207f2a4701199042182a411d5c13a Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Tue, 18 Oct 2016 09:16:21 +0100 Subject: [PATCH 01/10] Mac OS: Replace BSD with FreeBSD BSD is currently used to trigger the use of the FreeBSD video interface, which doesn't exist in MacOS. Change the BSD define to be FreeBSD specific. --- conf.c | 8 ++++---- event.c | 10 +++++----- motion.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conf.c b/conf.c index 5b324bc0..6057500c 100644 --- a/conf.c +++ b/conf.c @@ -29,11 +29,11 @@ #include "motion.h" -#if (defined(BSD) && !defined(PWCBSD)) +#if (defined(__FreeBSD__) && !defined(PWCBSD)) #include "video_freebsd.h" #else #include "video.h" -#endif /* BSD */ +#endif #define EXTENSION ".conf" @@ -114,7 +114,7 @@ struct config conf_template = { tuner_number: 0, timelapse: 0, timelapse_mode: DEF_TIMELAPSE_MODE, -#if (defined(BSD)) +#if (defined(__FreeBSD__)) tuner_device: NULL, #endif video_device: VIDEO_DEVICE, @@ -310,7 +310,7 @@ config_param config_params[] = { copy_int, print_int }, -#if (defined(BSD)) +#if (defined(__FreeBSD__)) { "tunerdevice", "# Tuner device to be used for capturing using tuner as source (default /dev/tuner0)\n" diff --git a/event.c b/event.c index 8ca59b0f..36b99631 100644 --- a/event.c +++ b/event.c @@ -11,7 +11,7 @@ #include "ffmpeg.h" /* must be first to avoid 'shadow' warning */ #include "picture.h" /* already includes motion.h */ #include "event.h" -#if (!defined(BSD)) +#if (!defined(__FreeBSD__)) #include "video.h" #endif @@ -317,7 +317,7 @@ static void event_sdl_put(struct context *cnt, #endif -#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD) +#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__) static void event_vid_putpipe(struct context *cnt, motion_event type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy ATTRIBUTE_UNUSED, void *devpipe, @@ -328,7 +328,7 @@ static void event_vid_putpipe(struct context *cnt, MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, "%s: Failed to put image into video pipe"); } } -#endif /* !WITHOUT_V4L && !BSD */ +#endif /* !WITHOUT_V4L && !__FreeBSD__ */ const char *imageext(struct context *cnt) { @@ -973,7 +973,7 @@ struct event_handlers event_handlers[] = { event_sdl_put }, #endif -#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD) +#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__) { EVENT_IMAGE, event_vid_putpipe @@ -982,7 +982,7 @@ struct event_handlers event_handlers[] = { EVENT_IMAGEM, event_vid_putpipe }, -#endif /* !WITHOUT_V4L && !BSD */ +#endif /* !WITHOUT_V4L && !__FreeBSD__ */ { EVENT_STREAM, event_stream_put diff --git a/motion.c b/motion.c index 0182fb7c..868d368a 100644 --- a/motion.c +++ b/motion.c @@ -9,7 +9,7 @@ #include "ffmpeg.h" #include "motion.h" -#if (defined(BSD) && !defined(PWCBSD)) +#if (defined(__FreeBSD__) && !defined(PWCBSD)) #include "video_freebsd.h" #else #include "video.h" @@ -789,7 +789,7 @@ static int motion_init(struct context *cnt) /* create a reference frame */ alg_update_reference_frame(cnt, RESET_REF_FRAME); -#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD) +#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__) /* open video loopback devices if enabled */ if (cnt->conf.vidpipe) { MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Opening video loopback device for normal pictures"); @@ -814,7 +814,7 @@ static int motion_init(struct context *cnt) return -1; } } -#endif /* !WITHOUT_V4L && !BSD */ +#endif /* !WITHOUT_V4L && !__FreeBSD__ */ #if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) if (cnt->conf.database_type) { @@ -2322,11 +2322,11 @@ static void become_daemon(void) MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Could not change directory"); -#if (defined(BSD)) +#if (defined(__FreeBSD__)) setpgrp(0, getpid()); #else setpgrp(); -#endif /* BSD */ +#endif /* __FreeBSD__ */ if ((i = open("/dev/tty", O_RDWR)) >= 0) { From 871e0dae8a41dc4b7e925c4e6e4207f393498f04 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Tue, 18 Oct 2016 09:19:48 +0100 Subject: [PATCH 02/10] MacOS: Remove our implementation of get_current_dir_name MacOS doesn't have this in the system, and we were providing our own version. This really isn't necessary as the system getcwd() is trivially usable instead, making the code the same on all platforms. --- conf.c | 16 +++------------- conf.h | 4 ---- configure.ac | 2 -- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/conf.c b/conf.c index 6057500c..0bf45ba6 100644 --- a/conf.c +++ b/conf.c @@ -37,15 +37,6 @@ #define EXTENSION ".conf" -#ifndef HAVE_GET_CURRENT_DIR_NAME -char *get_current_dir_name(void) -{ - char *buf = mymalloc(MAXPATHLEN); - getwd(buf); - return buf; -} -#endif - #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0; } struct config conf_template = { @@ -2007,20 +1998,19 @@ struct context **conf_load(struct context **cnt) } if (!fp) { /* Command-line didn't work, try current dir. */ - char *path = NULL; + char path[PATH_MAX]; if (cnt[0]->conf_filename[0]) MOTION_LOG(ALR, TYPE_ALL, SHOW_ERRNO, "%s: Configfile %s not found - trying defaults.", filename); - if ((path = get_current_dir_name()) == NULL) { - MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Error get_current_dir_name"); + if (getcwd(path, sizeof(path)) == NULL) { + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Error getcwd"); exit(-1); } snprintf(filename, PATH_MAX, "%s/motion.conf", path); fp = fopen (filename, "r"); - free(path); } if (!fp) { /* Specified file does not exist... try default file. */ diff --git a/conf.h b/conf.h index 1e940df6..c453bdec 100644 --- a/conf.h +++ b/conf.h @@ -177,8 +177,4 @@ char *mystrdup(const char *); char *mystrcpy(char *, const char *); struct context **copy_string(struct context **, const char *, int); -#ifndef HAVE_GET_CURRENT_DIR_NAME -char *get_current_dir_name(void); -#endif - #endif /* _INCLUDE_CONF_H */ diff --git a/configure.ac b/configure.ac index 7658a275..c03eb541 100644 --- a/configure.ac +++ b/configure.ac @@ -781,8 +781,6 @@ fi AC_HEADER_STDC AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h sys/videoio.h) -AC_CHECK_FUNCS(get_current_dir_name) - # Check if v4l2 is available SUPPORTED_V4L2=false SUPPORTED_V4L2_old=false From ab5835d43595ffc6e3b88b2ea5e4cd87a8c53e14 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Tue, 18 Oct 2016 09:24:27 +0100 Subject: [PATCH 03/10] MacOS: Add support for Mac variant of pthread_setname_np We add a simple wrapper #define to hide the difference between the Mac and other platforms version of this function. The tests should cover all our supported platforms, so remove the configure test. --- configure.ac | 12 ------------ logger.c | 4 ---- motion.c | 4 +--- motion.h | 7 +++++++ netcam.c | 4 +--- netcam_rtsp.c | 8 ++------ stream.c | 8 ++------ webhttpd.c | 4 +--- 8 files changed, 14 insertions(+), 37 deletions(-) diff --git a/configure.ac b/configure.ac index c03eb541..f14974d2 100644 --- a/configure.ac +++ b/configure.ac @@ -207,18 +207,6 @@ else echo fi - -if test "x$PTHREAD_SUPPORT" = "xyes"; then - AC_MSG_CHECKING([[for pthread_setname_np]]) - CFLAGS="$TEMP_CFLAGS" - LIBS="$TEMP_LIBS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], [[ pthread_setname_np(pthread_self(), "name")]])], - [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.]) - AC_MSG_RESULT([[yes]])], - [AC_MSG_RESULT([[no]])] ) -fi - # # Check for sdl library # diff --git a/logger.c b/logger.c index fffa4da0..96b7eb3a 100644 --- a/logger.c +++ b/logger.c @@ -191,12 +191,8 @@ void motion_log(int level, unsigned int type, int errno_flag, const char *fmt, . */ errno_save = errno; -#ifdef HAVE_PTHREAD_SETNAME_NP char threadname[32] = "unknown"; pthread_getname_np(pthread_self(), threadname, sizeof(threadname)); -#else /* HAVE_PTHREAD_SETNAME_NP */ - const char *threadname = ""; -#endif /* HAVE_PTHREAD_SETNAME_NP */ /* * Prefix the message with the log level string, log type string, diff --git a/motion.c b/motion.c index 868d368a..95784506 100644 --- a/motion.c +++ b/motion.c @@ -1104,16 +1104,14 @@ static void *motion_loop(void *arg) unsigned int get_image = 1; /* Flag used to signal that we capture new image when we run the loop */ struct image_data *old_image; -#ifdef HAVE_PTHREAD_SETNAME_NP { char tname[16]; snprintf(tname, sizeof(tname), "ml%d%s%s", cnt->threadnr, cnt->conf.camera_name ? ":" : "", cnt->conf.camera_name ? cnt->conf.camera_name : ""); - pthread_setname_np(pthread_self(), tname); + MOTION_PTHREAD_SETNAME(tname); } -#endif /* * Next two variables are used for snapshot and timelapse feature diff --git a/motion.h b/motion.h index b67add3a..fa55f3f1 100644 --- a/motion.h +++ b/motion.h @@ -70,6 +70,13 @@ #include "sdl.h" #endif +#ifdef __APPLE__ +#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(name) +#elif defined(__FreeBSD__) +#define MOTION_PTHREAD_SETNAME(name) pthread_set_name_np(pthread_self(), name) +#else +#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(pthread_self(), name) +#endif /** * ATTRIBUTE_UNUSED: diff --git a/netcam.c b/netcam.c index a9df33a0..e4de9c24 100644 --- a/netcam.c +++ b/netcam.c @@ -1767,16 +1767,14 @@ static void *netcam_handler_loop(void *arg) netcam_context_ptr netcam = arg; struct context *cnt = netcam->cnt; /* Needed for the SETUP macro :-( */ -#ifdef HAVE_PTHREAD_SETNAME_NP { char tname[16]; snprintf(tname, sizeof(tname), "nc%d%s%s", cnt->threadnr, cnt->conf.camera_name ? ":" : "", cnt->conf.camera_name ? cnt->conf.camera_name : ""); - pthread_setname_np(pthread_self(), tname); + MOTION_PTHREAD_SETNAME(tname); } -#endif /* Store the corresponding motion thread number in TLS also for this * thread (necessary for 'MOTION_LOG' to function properly). diff --git a/netcam_rtsp.c b/netcam_rtsp.c index abbc689f..c3e1a846 100644 --- a/netcam_rtsp.c +++ b/netcam_rtsp.c @@ -458,7 +458,6 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){ return -1; } -#ifdef HAVE_PTHREAD_SETNAME_NP /* there is no way to set the avcodec thread names, but they inherit * our thread name - so temporarily change our thread name to the * desired name */ @@ -470,15 +469,12 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){ netcam->cnt->threadnr, netcam->cnt->conf.camera_name ? ":" : "", netcam->cnt->conf.camera_name ? netcam->cnt->conf.camera_name : ""); - pthread_setname_np(pthread_self(), newtname); -#endif + MOTION_PTHREAD_SETNAME(newtname); retcd = netcam_open_codec(&netcam->rtsp->video_stream_index, netcam->rtsp->format_context, AVMEDIA_TYPE_VIDEO); -#ifdef HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(pthread_self(), curtname); + MOTION_PTHREAD_SETNAME(curtname); } -#endif if (retcd < 0) { if (netcam->rtsp->status == RTSP_NOTCONNECTED){ diff --git a/stream.c b/stream.c index 04e67ee9..fd9d334a 100644 --- a/stream.c +++ b/stream.c @@ -179,9 +179,7 @@ static void* handle_basic_auth(void* param) "Pragma: no-cache\r\n" "WWW-Authenticate: Basic realm=\""STREAM_REALM"\"\r\n\r\n"; -#ifdef HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(pthread_self(), "handle_basic_auth"); -#endif + MOTION_PTHREAD_SETNAME("handle_basic_auth"); pthread_mutex_lock(&stream_auth_mutex); p->thread_count++; @@ -436,9 +434,7 @@ static void* handle_md5_digest(void* param) "\n" "\n"; -#ifdef HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(pthread_self(), "handle_md5_digest"); -#endif + MOTION_PTHREAD_SETNAME("handle_md5_digest"); pthread_mutex_lock(&stream_auth_mutex); p->thread_count++; diff --git a/webhttpd.c b/webhttpd.c index 6df2d11d..10433b93 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -2658,9 +2658,7 @@ void *motion_web_control(void *arg) { struct context **cnt = arg; -#ifdef HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(pthread_self(), "web_control"); -#endif + MOTION_PTHREAD_SETNAME("web_control"); httpd_run(cnt); From a8709463e700a8d96bbc79219e5b10f315d6d3a6 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 10:45:33 +0100 Subject: [PATCH 04/10] Move from old GNU field designator to the standard C99 way The GNU style syntax has been marked as obsolete since gcc 2.5 I believe, which was released in 1993. Fixes some warnings in the macOS builds. --- conf.c | 226 ++++++++++++++++++++++++++++---------------------------- track.c | 38 +++++----- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/conf.c b/conf.c index 0bf45ba6..82043f1a 100644 --- a/conf.c +++ b/conf.c @@ -40,131 +40,131 @@ #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0; } struct config conf_template = { - camera_name: NULL, - width: DEF_WIDTH, - height: DEF_HEIGHT, - quality: DEF_QUALITY, - camera_id: 0, - rotate_deg: 0, - max_changes: DEF_CHANGES, - threshold_tune: 0, - output_pictures: "on", - motion_img: 0, - emulate_motion: 0, - event_gap: DEF_EVENT_GAP, - max_movie_time: DEF_MAXMOVIETIME, - snapshot_interval: 0, - locate_motion_mode: "off", - locate_motion_style: "box", - input: IN_DEFAULT, - norm: 0, - frame_limit: DEF_MAXFRAMERATE, - quiet: 1, - picture_type: "jpeg", - noise: DEF_NOISELEVEL, - noise_tune: 1, - minimum_frame_time: 0, - lightswitch: 0, - autobright: 0, - brightness: 0, - contrast: 0, - saturation: 0, - hue: 0, - power_line_frequency: -1, - roundrobin_frames: 1, - roundrobin_skip: 1, - pre_capture: 0, - post_capture: 0, - switchfilter: 0, - ffmpeg_output: 0, - extpipe: NULL, - useextpipe: 0, - ffmpeg_output_debug: 0, - ffmpeg_bps: DEF_FFMPEG_BPS, - ffmpeg_vbr: DEF_FFMPEG_VBR, - ffmpeg_video_codec: DEF_FFMPEG_CODEC, + .camera_name = NULL, + .width = DEF_WIDTH, + .height = DEF_HEIGHT, + .quality = DEF_QUALITY, + .camera_id = 0, + .rotate_deg = 0, + .max_changes = DEF_CHANGES, + .threshold_tune = 0, + .output_pictures = "on", + .motion_img = 0, + .emulate_motion = 0, + .event_gap = DEF_EVENT_GAP, + .max_movie_time = DEF_MAXMOVIETIME, + .snapshot_interval = 0, + .locate_motion_mode = "off", + .locate_motion_style = "box", + .input = IN_DEFAULT, + .norm = 0, + .frame_limit = DEF_MAXFRAMERATE, + .quiet = 1, + .picture_type = "jpeg", + .noise = DEF_NOISELEVEL, + .noise_tune = 1, + .minimum_frame_time = 0, + .lightswitch = 0, + .autobright = 0, + .brightness = 0, + .contrast = 0, + .saturation = 0, + .hue = 0, + .power_line_frequency = -1, + .roundrobin_frames = 1, + .roundrobin_skip = 1, + .pre_capture = 0, + .post_capture = 0, + .switchfilter = 0, + .ffmpeg_output = 0, + .extpipe = NULL, + .useextpipe = 0, + .ffmpeg_output_debug = 0, + .ffmpeg_bps = DEF_FFMPEG_BPS, + .ffmpeg_vbr = DEF_FFMPEG_VBR, + .ffmpeg_video_codec = DEF_FFMPEG_CODEC, #ifdef HAVE_SDL sdl_threadnr: 0, #endif - ipv6_enabled: 0, - stream_port: 0, - stream_quality: 50, - stream_motion: 0, - stream_maxrate: 1, - stream_localhost: 1, - stream_limit: 0, - stream_auth_method: 0, - stream_authentication: NULL, - stream_preview_scale: 25, - stream_preview_newline: 0, - webcontrol_port: 0, - webcontrol_localhost: 1, - webcontrol_html_output: 1, - webcontrol_authentication: NULL, - frequency: 0, - tuner_number: 0, - timelapse: 0, - timelapse_mode: DEF_TIMELAPSE_MODE, + .ipv6_enabled = 0, + .stream_port = 0, + .stream_quality = 50, + .stream_motion = 0, + .stream_maxrate = 1, + .stream_localhost = 1, + .stream_limit = 0, + .stream_auth_method = 0, + .stream_authentication = NULL, + .stream_preview_scale = 25, + .stream_preview_newline = 0, + .webcontrol_port = 0, + .webcontrol_localhost = 1, + .webcontrol_html_output = 1, + .webcontrol_authentication = NULL, + .frequency = 0, + .tuner_number = 0, + .timelapse = 0, + .timelapse_mode = DEF_TIMELAPSE_MODE, #if (defined(__FreeBSD__)) tuner_device: NULL, #endif - video_device: VIDEO_DEVICE, - v4l2_palette: DEF_PALETTE, - vidpipe: NULL, - filepath: NULL, - imagepath: DEF_IMAGEPATH, - moviepath: DEF_MOVIEPATH, - snappath: DEF_SNAPPATH, - timepath: DEF_TIMEPATH, - on_event_start: NULL, - on_event_end: NULL, - mask_file: NULL, - smart_mask_speed: 0, + .video_device = VIDEO_DEVICE, + .v4l2_palette = DEF_PALETTE, + .vidpipe = NULL, + .filepath = NULL, + .imagepath = DEF_IMAGEPATH, + .moviepath = DEF_MOVIEPATH, + .snappath = DEF_SNAPPATH, + .timepath = DEF_TIMEPATH, + .on_event_start = NULL, + .on_event_end = NULL, + .mask_file = NULL, + .smart_mask_speed = 0, #if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) - sql_log_image: 1, - sql_log_snapshot: 1, - sql_log_movie: 0, - sql_log_timelapse: 0, - sql_query: DEF_SQL_QUERY, - database_type: NULL, - database_dbname: NULL, - database_host: "localhost", - database_user: NULL, - database_password: NULL, - database_port: 0, - database_busy_timeout: 0, + .sql_log_image = 1, + .sql_log_snapshot = 1, + .sql_log_movie = 0, + .sql_log_timelapse = 0, + .sql_query = DEF_SQL_QUERY, + .database_type = NULL, + .database_dbname = NULL, + .database_host = "localhost", + .database_user = NULL, + .database_password = NULL, + .database_port = 0, + .database_busy_timeout = 0, #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || define(HAVE_SQLITE3) */ - on_picture_save: NULL, - on_motion_detected: NULL, - on_area_detected: NULL, - on_movie_start: NULL, - on_movie_end: NULL, - on_camera_lost: NULL, - motionvidpipe: NULL, - netcam_url: NULL, - netcam_userpass: NULL, - netcam_keepalive: "off", - netcam_proxy: NULL, - netcam_tolerant_check: 0, - rtsp_uses_tcp: 1, + .on_picture_save = NULL, + .on_motion_detected = NULL, + .on_area_detected = NULL, + .on_movie_start = NULL, + .on_movie_end = NULL, + .on_camera_lost = NULL, + .motionvidpipe = NULL, + .netcam_url = NULL, + .netcam_userpass = NULL, + .netcam_keepalive = "off", + .netcam_proxy = NULL, + .netcam_tolerant_check = 0, + .rtsp_uses_tcp = 1, #ifdef HAVE_MMAL mmalcam_name: NULL, mmalcam_control_params: NULL, #endif - text_changes: 0, - text_left: NULL, - text_right: DEF_TIMESTAMP, - text_event: DEF_EVENTSTAMP, - text_double: 0, - despeckle_filter: NULL, - area_detect: NULL, - minimum_motion_frames: 1, - exif_text: NULL, - pid_file: NULL, - log_file: NULL, - log_level: LEVEL_DEFAULT+10, - log_type_str: NULL, - camera_dir: sysconfdir"/conf.d" + .text_changes = 0, + .text_left = NULL, + .text_right = DEF_TIMESTAMP, + .text_event = DEF_EVENTSTAMP, + .text_double = 0, + .despeckle_filter = NULL, + .area_detect = NULL, + .minimum_motion_frames = 1, + .exif_text = NULL, + .pid_file = NULL, + .log_file = NULL, + .log_level = LEVEL_DEFAULT+10, + .log_type_str = NULL, + .camera_dir = sysconfdir"/conf.d" }; diff --git a/track.c b/track.c index cc0a709c..3bc77197 100644 --- a/track.c +++ b/track.c @@ -17,25 +17,25 @@ struct trackoptions track_template = { - dev: -1, /* dev open */ - port: NULL, /* char *port */ - motorx: 0, /* int motorx */ - motory: 0, /* int motory */ - maxx: 0, /* int maxx; */ - maxy: 0, /* int maxy; */ - minx: 0, /* int minx; */ - miny: 0, /* int miny; */ - homex: 128, /* int homex; */ - homey: 128, /* int homey; */ - motorx_reverse: 0, /* int reversed x servo; */ - motory_reverse: 0, /* int reversed y servo; */ - speed: TRACK_SPEED, /* speed */ - stepsize: TRACK_STEPSIZE, /* stepsize */ - active: 0, /* auto tracking active */ - minmaxfound: 0, /* flag for minmax values stored for pwc based camera */ - step_angle_x: 10, /* UVC step angle in degrees X-axis that camera moves during auto tracking */ - step_angle_y: 10, /* UVC step angle in degrees Y-axis that camera moves during auto tracking */ - move_wait: 10 /* number of frames to disable motion detection after camera moving */ + .dev = -1, /* dev open */ + .port = NULL, /* char *port */ + .motorx = 0, /* int motorx */ + .motory = 0, /* int motory */ + .maxx = 0, /* int maxx; */ + .maxy = 0, /* int maxy; */ + .minx = 0, /* int minx; */ + .miny = 0, /* int miny; */ + .homex = 128, /* int homex; */ + .homey = 128, /* int homey; */ + .motorx_reverse = 0, /* int reversed x servo; */ + .motory_reverse = 0, /* int reversed y servo; */ + .speed = TRACK_SPEED, /* speed */ + .stepsize = TRACK_STEPSIZE, /* stepsize */ + .active = 0, /* auto tracking active */ + .minmaxfound = 0, /* flag for minmax values stored for pwc based camera */ + .step_angle_x = 10, /* UVC step angle in degrees X-axis that camera moves during auto tracking */ + .step_angle_y = 10, /* UVC step angle in degrees Y-axis that camera moves during auto tracking */ + .move_wait = 10 /* number of frames to disable motion detection after camera moving */ }; From 841f8500d6a8bd60c42fd15f1676aac857d9da67 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 11:55:47 +0100 Subject: [PATCH 05/10] MacOS: Fix socket binding macOS's bind() insists that the size argument passed is correct for the type of socket in use. Also update the relevant MOTION_LOG to include errno. --- stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stream.c b/stream.c index fd9d334a..328d8f4e 100644 --- a/stream.c +++ b/stream.c @@ -722,6 +722,7 @@ int http_bindsock(int port, int local, int ipv6_enabled) const char *addr_str; struct sockaddr_storage sin; + socklen_t sinsize; bzero(&sin, sizeof(struct sockaddr_storage)); sin.ss_family = ipv6_enabled?AF_INET6:AF_INET; if (ipv6_enabled) { @@ -735,6 +736,7 @@ int http_bindsock(int port, int local, int ipv6_enabled) addr_str = "any IPv4/IPv6 address"; sin6->sin6_addr = in6addr_any; } + sinsize = sizeof(*sin6); } else { struct sockaddr_in *sin4 = (struct sockaddr_in*)&sin; sin4->sin_family = AF_INET; @@ -746,10 +748,11 @@ int http_bindsock(int port, int local, int ipv6_enabled) addr_str = "any IPv4 address"; sin4->sin_addr.s_addr = htonl(INADDR_ANY); } + sinsize = sizeof(*sin4); } - if (bind(sd, (struct sockaddr*)&sin, sizeof(sin)) != 0) { - MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, "%s: error binding on %s port %d", addr_str, port); + if (bind(sd, (struct sockaddr*)&sin, sinsize) != 0) { + MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: error binding on %s port %d", addr_str, port); close(sd); return -1; } From 10258c4434c97faff05cf12764c77f15f8aba57a Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 11:56:45 +0100 Subject: [PATCH 06/10] Tidyup http_bindsock Make sure we pass IPPROTO_TCP, and check all the socket operations for success. --- stream.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/stream.c b/stream.c index 328d8f4e..052f02d2 100644 --- a/stream.c +++ b/stream.c @@ -713,12 +713,29 @@ Error: */ int http_bindsock(int port, int local, int ipv6_enabled) { - int sd = socket(ipv6_enabled?AF_INET6:AF_INET, SOCK_STREAM, 0); + int sd = socket(ipv6_enabled?AF_INET6:AF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (sd == -1) + { + MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: error creating socket"); + return -1; + } int yes = 1, no = 0; - setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)); + if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) != 0) + { + MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: setting SO_REUSEADDR to yes failed"); + /* we can carry on even if this failed */ + } + if (ipv6_enabled) - setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no)); + { + if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no)) != 0) + { + MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: setting IPV6_V6ONLY to no failed"); + /* we can carry on even if this failed */ + } + } const char *addr_str; struct sockaddr_storage sin; From 9f531674ab346d0a195e36db4e18a1612d1d5147 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 12:01:07 +0100 Subject: [PATCH 07/10] macOS: Fix sockaddr type mismatch warnings Add missing casts --- netcam.c | 2 +- webhttpd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netcam.c b/netcam.c index e4de9c24..3c693d14 100644 --- a/netcam.c +++ b/netcam.c @@ -948,7 +948,7 @@ static int netcam_connect(netcam_context_ptr netcam, int err_flag) } /* Now the connect call will return immediately. */ - ret = connect(netcam->sock, &server, sizeof(server)); + ret = connect(netcam->sock, (struct sockaddr *)&server, sizeof(server)); back_err = errno; /* Save the errno from connect */ /* If the connect failed with anything except EINPROGRESS, error. */ diff --git a/webhttpd.c b/webhttpd.c index 10433b93..81e8c89c 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -2571,7 +2571,7 @@ static int acceptnonblocking(int serverfd, int timeout) if (select(serverfd + 1, &fds, NULL, NULL, &tm) > 0) { if (FD_ISSET(serverfd, &fds)) { - if ((curfd = accept(serverfd, &client, &client_len)) > 0) + if ((curfd = accept(serverfd, (struct sockaddr *)&client, &client_len)) > 0) return curfd; } } From 67ae55d0032db91b3f4262b6d968089aa9521da4 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 12:02:53 +0100 Subject: [PATCH 08/10] macOS: Fix warnings about always true comparison Fix the warnings like: Comparison of array 'command' not equal to a null pointer is always true command is an array, so can never be NULL, so don't bother checking --- motion.c | 2 +- webhttpd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/motion.c b/motion.c index 95784506..805c4904 100644 --- a/motion.c +++ b/motion.c @@ -3225,7 +3225,7 @@ size_t mystrftime(const struct context *cnt, char *s, size_t max, const char *us break; case 'C': // text_event - if (cnt->text_event_string && cnt->text_event_string[0]) + if (cnt->text_event_string[0]) snprintf(tempstr, PATH_MAX, "%*s", width, cnt->text_event_string); else diff --git a/webhttpd.c b/webhttpd.c index 81e8c89c..039f1d99 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -1936,7 +1936,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, pointer = pointer + 6; length_uri = length_uri - 6; warningkill = sscanf(pointer, "%255[-0-9a-z]" , command); - if ((command != NULL) && (strlen(command) > 0)) { + if (strlen(command) > 0) { struct context *autocnt; /* auto value=0|1|status */ From 0055ef32ae5e99636ef24148cf7311f091cca8ae Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 23 Oct 2016 12:11:10 +0100 Subject: [PATCH 09/10] MacOS: Fix warnings about mismatched format specifiers Most changing %hu (unsigned short) to %u (unsigned int) for the threadnumber, which is an unsigned int - but various other fixes along the same lines. --- webhttpd.c | 170 ++++++++++++++++++++++++++--------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/webhttpd.c b/webhttpd.c index 039f1d99..a5884744 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -435,7 +435,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, /*call list*/ if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

\nCamera %d%s%s\n
    ", + sprintf(res, "<– back

    \nCamera %d%s%s\n
      ", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -488,30 +488,30 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, retval = mystrdup(thread_strings); } - sprintf(res, "
    • %s = %s
    • \n", thread, + sprintf(res, "
    • %s = %s
    • \n", thread, config_params[i].param_name, config_params[i].param_name, retval); free(retval); } else if (thread != 0) { /* get the value from main thread for the rest of threads */ value = config_params[i].print(cnt, NULL, i, 0); - sprintf(res, "
    • %s = %s
    • \n", thread, + sprintf(res, "
    • %s = %s
    • \n", thread, config_params[i].param_name, config_params[i].param_name, value ? value : "(not defined)"); } else { - sprintf(res, "
    • %s = %s
    • \n", thread, + sprintf(res, "
    • %s = %s
    • \n", thread, config_params[i].param_name, config_params[i].param_name, "(not defined)"); } } else { - sprintf(res, "
    • %s = %s
    • \n", thread, + sprintf(res, "
    • %s = %s
    • \n", thread, config_params[i].param_name, config_params[i].param_name, value); } send_template(client_socket, res); } - sprintf(res, "
    <– back", thread); + sprintf(res, "
<– back", thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { @@ -567,9 +567,9 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, conf_cmdparse(cnt + thread, config_params[i].param_name, Value); if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, - "<– back" + "<– back" "

\nCamera %d%s%s\n" - "
  • %s = %s" + "
    • %s = %s" "
    Done", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", @@ -616,8 +616,8 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, - "<– back

    \n" - "Camera %d%s%s\n
    • %s" + "<– back

      \n" + "Camera %d%s%s\n
      Done", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "", @@ -686,7 +686,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, sprintf(option, "\n" "\n"); - sprintf(res, "<– back

      \n" + sprintf(res, "<– back

      \n" "Camera %d%s%s\n" "
      \n" "%s \n" "\n" @@ -739,7 +739,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, } else if (length_uri == 0) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, set_template); - sprintf(res, "<– back

      \nCamera %d%s%s\n" + sprintf(res, "<– back

      \nCamera %d%s%s\n" "\n\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", @@ -908,8 +908,8 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, if (length_uri == 0) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " - "Are you sure? Yes\n", thread, thread); + sprintf(res, "<– back

      " + "Are you sure? Yes\n", thread, thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { @@ -933,7 +933,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri, conf_print(cnt); if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s write done !\n", + sprintf(res, "<– back

      \nCamera %d%s%s write done !\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -996,13 +996,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \n" - "makemovie for thread %hu done
      \n", thread, thread); + sprintf(res, "<– back

      \n" + "makemovie for thread %u done
      \n", thread, thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { send_template_ini_client_raw(client_socket); - sprintf(res, "makemovie for thread %hu\nDone\n", thread); + sprintf(res, "makemovie for thread %u\nDone\n", thread); send_template_raw(client_socket, res); } } else { @@ -1028,13 +1028,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri, cnt[thread]->snapshot = 1; if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \n" - "snapshot for thread %hu done
      \n", thread, thread); + sprintf(res, "<– back

      \n" + "snapshot for thread %u done
      \n", thread, thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { send_template_ini_client_raw(client_socket); - sprintf(res, "snapshot for thread %hu\nDone\n", thread); + sprintf(res, "snapshot for thread %u\nDone\n", thread); send_template_raw(client_socket, res); } } else { @@ -1074,13 +1074,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri, cnt[thread]->restart = 1; if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \n" - "restart for thread %hu done
      \n", thread, thread); + sprintf(res, "<– back

      \n" + "restart for thread %u done
      \n", thread, thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { send_template_ini_client_raw(client_socket); - sprintf(res, "restart for thread %hu\nDone\n", thread); + sprintf(res, "restart for thread %u\nDone\n", thread); send_template_raw(client_socket, res); } } @@ -1119,13 +1119,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri, cnt[thread]->watchdog = WATCHDOG_OFF; if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \n" - "quit for thread %hu done
      \n", thread, thread); + sprintf(res, "<– back

      \n" + "quit for thread %u done
      \n", thread, thread); send_template(client_socket, res); send_template_end_client(client_socket); } else { send_template_ini_client_raw(client_socket); - sprintf(res, "quit for thread %hu\nDone\n", thread); + sprintf(res, "quit for thread %u\nDone\n", thread); send_template_raw(client_socket, res); } } @@ -1170,7 +1170,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      Camera %d%s%s" + sprintf(res, "<– back

      Camera %d%s%s" " Detection status %s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "", @@ -1206,7 +1206,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s" + sprintf(res, "<– back

      \nCamera %d%s%s" " Detection resumed\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1240,7 +1240,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s" + sprintf(res, "<– back

      \nCamera %d%s%s" " Detection paused\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1268,7 +1268,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri, /* call connection */ if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \n", thread); + sprintf(res, "<– back

      \n", thread); send_template(client_socket, res); if (thread == 0) { do{ @@ -1453,7 +1453,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track set relative pan=%s
      \n", thread, cnt[thread]->conf.camera_id, @@ -1470,7 +1470,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track action */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1495,7 +1495,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track set relative tilt=%s\n", thread, cnt[thread]->conf.camera_id, @@ -1512,7 +1512,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track action */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1529,7 +1529,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track set absolute x=%s\n", thread, cnt[thread]->conf.camera_id, @@ -1546,7 +1546,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track action */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1564,7 +1564,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track set absolute y=%s
      \n", thread, cnt[thread]->conf.camera_id, @@ -1581,7 +1581,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track action */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1741,7 +1741,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track absolute set x=%s y=%s
      \n", thread, cnt[thread]->conf.camera_id, @@ -1758,7 +1758,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track action */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1796,7 +1796,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[thread]->moved) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      \n" "track relative pan=%s tilt=%s\n", thread, cnt[thread]->conf.camera_id, @@ -1815,7 +1815,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else { /* error in track tilt */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1828,7 +1828,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, /* error in track pan */ if (cnt[0]->conf.webcontrol_html_output) { - sprintf(res, "<– back

      Camera %d%s%s\n", + sprintf(res, "<– back

      Camera %d%s%s\n", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1840,7 +1840,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, } else if (length_uri == 0) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s
      \n" + sprintf(res, "<– back

      \nCamera %d%s%s
      \n" "\n" "Pan\n" "Tilt\n" @@ -1878,7 +1878,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s" + sprintf(res, "<– back

      \nCamera %d%s%s" "
      track set center", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : ""); @@ -1902,7 +1902,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (length_uri==0) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s" + sprintf(res, "<– back

      \nCamera %d%s%s" "
      track auto %s", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "", @@ -1944,7 +1944,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (!strcmp(command, "status")) { if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s
      " "track auto %s", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", @@ -1967,7 +1967,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, autocnt->track.active = active; if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      " + sprintf(res, "<– back

      " "Camera %d%s%s" "
      track auto %s
      ", thread, cnt[thread]->conf.camera_id, cnt[thread]->conf.camera_name ? " -- " : "", @@ -2003,7 +2003,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri, if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); - sprintf(res, "<– back

      \nCamera %d%s%s\n" + sprintf(res, "<– back

      \nCamera %d%s%s\n" "