pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

zoneminder: Merge patches



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Tue Sep 27 08:19:19 2022 -0400
Changeset:	b6308d1e2a45640ea9a2759e9d3949f1804580f6

Modified Files:
	zoneminder/distinfo
	zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in
	zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm
	zoneminder/patches/patch-scripts_zmpkg_pl_in
	zoneminder/patches/patch-src_zm__event.cpp
	zoneminder/patches/patch-src_zm__monitor.cpp
	zoneminder/patches/patch-src_zm__rtp__source.cpp
	zoneminder/patches/patch-src_zm__thread.h
	zoneminder/patches/patch-src_zm__timer.h
	zoneminder/patches/patch-src_zm__utils.cpp
	zoneminder/patches/patch-src_zm__utils.h
	zoneminder/patches/patch-src_zm_comms_h
	zoneminder/patches/patch-src_zm_logger_cpp
	zoneminder/patches/patch-src_zm_remote_camera_h
	zoneminder/patches/patch-src_zm_signal_cpp
	zoneminder/patches/patch-src_zm_thread_cpp
	zoneminder/patches/patch-src_zmc_cpp
	zoneminder/patches/patch-src_zmu.cpp
Removed Files:
	zoneminder/patches/patch-web_ajax_stream_php

Log Message:
zoneminder: Merge patches

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b6308d1e2a45640ea9a2759e9d3949f1804580f6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zoneminder/distinfo                                |  35 +++---
 ...ipts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in |  27 ++--
 ...ch-scripts_ZoneMinder_lib_ZoneMinder_General_pm |  10 +-
 zoneminder/patches/patch-scripts_zmpkg_pl_in       |  18 +--
 zoneminder/patches/patch-src_zm__event.cpp         | 139 ++++++++++-----------
 zoneminder/patches/patch-src_zm__monitor.cpp       |  22 ++--
 zoneminder/patches/patch-src_zm__rtp__source.cpp   |   6 +-
 zoneminder/patches/patch-src_zm__thread.h          |  40 +++---
 zoneminder/patches/patch-src_zm__timer.h           |   8 +-
 zoneminder/patches/patch-src_zm__utils.cpp         |  14 +--
 zoneminder/patches/patch-src_zm__utils.h           |   8 +-
 zoneminder/patches/patch-src_zm_comms_h            |   9 +-
 zoneminder/patches/patch-src_zm_logger_cpp         |  65 +++-------
 zoneminder/patches/patch-src_zm_remote_camera_h    |  14 ++-
 zoneminder/patches/patch-src_zm_signal_cpp         |  10 +-
 zoneminder/patches/patch-src_zm_thread_cpp         |  32 ++---
 zoneminder/patches/patch-src_zmc_cpp               |  18 +--
 zoneminder/patches/patch-src_zmu.cpp               |  32 +++--
 zoneminder/patches/patch-web_ajax_stream_php       |  15 ---
 19 files changed, 229 insertions(+), 293 deletions(-)

diffs:
diff --git a/zoneminder/distinfo b/zoneminder/distinfo
index d7bd85f98d..db5860b70f 100644
--- a/zoneminder/distinfo
+++ b/zoneminder/distinfo
@@ -8,25 +8,24 @@ SHA512 (ZoneMinder-1.32.3.tar.gz) = 1226127a1352ebc6e80ba0cbdb3ecbae27cf64a75b76
 Size (ZoneMinder-1.32.3.tar.gz) = 10656921 bytes
 SHA1 (patch-CMakeLists.txt) = cfc565e597d48c6b3c54e1aba53e5f1b4e19f34a
 SHA1 (patch-cmake_Modules_Pod2Man.cmake) = f0a1462037fc63fa9f35d0595f4f50946f5518e7
-SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in) = b8f508abcd5451da73092070a302b99d1fd59def
-SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = bded373e318cd074b92853165d5ca38d23bdea5f
+SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in) = 3bf4e5e8276a682695db640e6608dd14c7315320
+SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = 84a1db650e90aa8e4dfe4c7633f1e5b41022fd01
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_Memory_Shared.pm) = b97c104f6ac102fc4510eb0977169375cdd97197
 SHA1 (patch-scripts_zm_in) = a05727261bb8be6b707e9a14ae4ff52ea3770d51
-SHA1 (patch-scripts_zmpkg_pl_in) = 04f30a02ad5132a58c5396bbf5dbb92280eddb8f
-SHA1 (patch-src_zm__event.cpp) = 5908b0fd1390505d851172b1f6f449f1c48f7fde
-SHA1 (patch-src_zm__monitor.cpp) = f690dae0adee48faeb94a393ca22f1ec49e8331e
+SHA1 (patch-scripts_zmpkg_pl_in) = 1dd13f9d3a5901e89ff8ac6062de9272dbea2d58
+SHA1 (patch-src_zm__event.cpp) = 0fe0a96db5ca3f6753d3922f3b22c44827055cfe
+SHA1 (patch-src_zm__monitor.cpp) = 5611aa37187bc9910ba1ccd9ddd5d0f421438b53
 SHA1 (patch-src_zm__rtp__ctrl.h) = 4e0fd8e80932de8d77b3386a356cc026ddc23113
-SHA1 (patch-src_zm__rtp__source.cpp) = 039257e76768df2e32a5550625ba7f8d1cb9ba26
-SHA1 (patch-src_zm__thread.h) = 8ac734f991c74a8744f7ee7015e583a701517951
-SHA1 (patch-src_zm__timer.h) = d91d41ef987fa4cc67d6f55c25afc581ef3a273f
-SHA1 (patch-src_zm__utils.cpp) = d5012fb54b0a91640fa49a16daf7c5f0eb54228e
-SHA1 (patch-src_zm__utils.h) = 4ffb7eafa8602076766fd4ae00be797866a229d9
+SHA1 (patch-src_zm__rtp__source.cpp) = 2488ae3655f529a71d8b98fa29a9e0435bbdf182
+SHA1 (patch-src_zm__thread.h) = 80c15ea1a949c3a1728ddb1bbcbb50facc9e14f8
+SHA1 (patch-src_zm__timer.h) = c415a98f0bfbc5a4082bacb9ff1213ea7eca1c8f
+SHA1 (patch-src_zm__utils.cpp) = 49fc733e9ee79d2be4beebe2ec61398a0f292f30
+SHA1 (patch-src_zm__utils.h) = 02501e21103514c7bed76676156e23d4f165342e
 SHA1 (patch-src_zm_comms_cpp) = bd3c3e6dd4d11ea0845d2da662e99169cd6e6680
-SHA1 (patch-src_zm_comms_h) = 64c0a8e98f9ac551113f3428dafff12a61ea9afe
-SHA1 (patch-src_zm_logger_cpp) = 3ad97a499643d9af5bbd1f86d9b4101bc24be4df
-SHA1 (patch-src_zm_remote_camera_h) = 0d4bd7dae0188df7e463586250ac2ed530230f3d
-SHA1 (patch-src_zm_signal_cpp) = 6863c33f22d40fd9dabdab7ba7056d56fae9d418
-SHA1 (patch-src_zm_thread_cpp) = 3d59ce545ee5ce16417b635e4b963867f4e15741
-SHA1 (patch-src_zmc_cpp) = 925a6fa9ab28b54b5ba0bc5fd657a16c1e59d46e
-SHA1 (patch-src_zmu.cpp) = a238a58cf383e847b69031ec06c929c960cafc6e
-SHA1 (patch-web_ajax_stream_php) = e8f811e63bedec03345b74db72c3d8014b3cc7f6
+SHA1 (patch-src_zm_comms_h) = e9e25dced4ad54aa118f153fbd3390d1eb525e65
+SHA1 (patch-src_zm_logger_cpp) = 79c604a7f85f03acb13e8bce1f4fe48d4cd98cca
+SHA1 (patch-src_zm_remote_camera_h) = 87da3e6326df5f9ab3c98fed5c7c9bae20cd6dc5
+SHA1 (patch-src_zm_signal_cpp) = af9625702518648b8d62ed20d0d52c1a2a27841a
+SHA1 (patch-src_zm_thread_cpp) = 165a1e38eb76f5cfe72606b1071177e619d73fe6
+SHA1 (patch-src_zmc_cpp) = 1499eb3e2d92372a0dea036f22f429efeefe4d95
+SHA1 (patch-src_zmu.cpp) = a2ee3b7a96f427b3df58e434ca7b55b5258f653e
diff --git a/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in b/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in
index e6026c5e0b..e9298ffc26 100644
--- a/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in
+++ b/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in
@@ -6,23 +6,14 @@ should be opt-in rather than opt-out.
 The ConfigData.pm module determines what the default setting is for new
 options during an upgrade as well as on an initial installation.
 
---- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in.orig	2022-01-23 22:09:24.000000000 +1300
-+++ scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in	2022-01-23 22:11:28.000000000 +1300
-@@ -2787,7 +2787,7 @@
+--- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in.orig	2018-12-08 14:22:36.000000000 +0000
++++ scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in
+@@ -2693,7 +2693,7 @@ our @options = (
    },
    {
-     name        => "ZM_CHECK_FOR_UPDATES",
--    default     => "yes",
-+    default     => "no",
-     description => "Check with zoneminder.com for updated versions",
-     help        => qqq("
-         From ZoneMinder version 1.17.0 onwards new versions are
-@@ -2805,7 +2805,7 @@
-   },
-   {
-     name        => "ZM_TELEMETRY_DATA",
--    default     => "yes",
-+    default     => "no",
-     description => "Send usage information to ZoneMinder",
-     help        => qqq("
-         Enable collection of usage information of the local system and send
+     name        => 'ZM_CHECK_FOR_UPDATES',
+-    default     => 'yes',
++    default     => 'no',
+     description => 'Check with zoneminder.com for updated versions',
+     help        => q`
+       From ZoneMinder version 1.17.0 onwards new versions are
diff --git a/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm b/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm
index 2fd3c6c70b..c33e2c7318 100644
--- a/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm
+++ b/zoneminder/patches/patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm
@@ -19,14 +19,14 @@ installed on the system, or not in the $PATH.
 
 Use the -m parameter to su, as ZM_WEB_USER shouldn't require a login shell.
 
---- scripts/ZoneMinder/lib/ZoneMinder/General.pm.orig	2019-02-22 15:38:47.000000000 +0000
+--- scripts/ZoneMinder/lib/ZoneMinder/General.pm.orig	2018-12-08 14:22:36.000000000 +0000
 +++ scripts/ZoneMinder/lib/ZoneMinder/General.pm
-@@ -129,7 +129,7 @@ sub getCmdFormat {
-       chomp( $output );
-       Debug( "Test failed, '$output'\n" );
+@@ -104,7 +104,7 @@ sub getCmdFormat {
+       chomp($output);
+       Debug("Test failed, '$output'");
  
 -      $prefix = "su ".$Config{ZM_WEB_USER}." -c '";
 +      $prefix = "su -m ".$Config{ZM_WEB_USER}." -c '";
        $suffix = "'";
        $command = $prefix.$null_command.$suffix;
-       Debug( "Testing \"$command\"\n" );
+       Debug("Testing \"$command\"");
diff --git a/zoneminder/patches/patch-scripts_zmpkg_pl_in b/zoneminder/patches/patch-scripts_zmpkg_pl_in
index b5e3f2cbd1..14cb56dd67 100644
--- a/zoneminder/patches/patch-scripts_zmpkg_pl_in
+++ b/zoneminder/patches/patch-scripts_zmpkg_pl_in
@@ -7,14 +7,14 @@ between zmpkg.pl and systemd or init - such as /etc/init.d/zoneminder
 But everything does seem to work ok from systemd without this roundabout code
 anyway, so just inhibit it.
 
---- scripts/zmpkg.pl.in.orig	2021-09-26 20:28:10.324733138 +1300
-+++ scripts/zmpkg.pl.in	2021-09-26 20:28:30.414613144 +1300
-@@ -168,7 +168,7 @@
- }
+--- scripts/zmpkg.pl.in.orig	2018-12-08 14:22:36.000000000 +0000
++++ scripts/zmpkg.pl.in
+@@ -143,7 +143,7 @@ if ( $command eq 'state' ) {
+ } # end if command = state
  
  # Check if we are running systemd and if we have been called by the system
--if ( $command =~ /^(start|stop|restart)$/ )
-+if ( 0 && $command =~ /^(start|stop|restart)$/ )
- {
-     # We have to detaint to keep perl from complaining
-     $command = $1;
+-if ( $command =~ /^(start|stop|restart)$/ ) {
++if ( 0 && $command =~ /^(start|stop|restart)$/ ) {
+ # We have to detaint to keep perl from complaining
+   $command = $1;
+ 
diff --git a/zoneminder/patches/patch-src_zm__event.cpp b/zoneminder/patches/patch-src_zm__event.cpp
index 726ab09700..8f2a2f664c 100644
--- a/zoneminder/patches/patch-src_zm__event.cpp
+++ b/zoneminder/patches/patch-src_zm__event.cpp
@@ -10,83 +10,80 @@ Also, this fix is expedient and probably a better fix is appropriate.
 
 Avoid sendfile code when sendfile doesn't exist.
 
---- src/zm_event.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_event.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_event.cpp
-@@ -36,11 +36,13 @@
- #include "zm_event.h"
- #include "zm_monitor.h"
+@@ -87,10 +87,10 @@ Event::Event(
  
-+#if HAVE_SENDFILE
- // sendfile tricks
- extern "C"
- {
- #include "zm_sendfile.h"
- }
-+#endif
- 
- #include "zmf.h"
- 
-@@ -80,7 +82,7 @@ Event::Event( Monitor *p_monitor, struct
-   static char sql[ZM_SQL_MED_BUFSIZ];
- 
-   struct tm *stime = localtime( &start_time.tv_sec );
--  snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, Name, StartTime, Width, Height, Cause, Notes ) values ( %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s' )", monitor->Id(), start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str() );
-+  snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, Name, StartTime, Width, Height, Cause, Notes ) values ( %d, 'New Event', from_unixtime( %jd ), %d, %d, '%s', '%s' )", monitor->Id(), (intmax_t) start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str() );
-   if ( mysql_query( &dbconn, sql ) )
-   {
-     Error( "Can't insert event: %s", mysql_error( &dbconn ) );
-@@ -181,7 +183,7 @@ Event::~Event()
- 
-     Debug( 1, "Adding closing frame %d to DB", frames );
-     static char sql[ZM_SQL_SML_BUFSIZ];
--    snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %ld ), %s%ld.%02ld )", id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
-+    snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %jd ), %s%jd.%02ld )", id, frames, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec );
-     if ( mysql_query( &dbconn, sql ) )
-     {
-       Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
-@@ -194,7 +196,7 @@ Event::~Event()
-   struct DeltaTimeval delta_time;
-   DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
+   char sql[ZM_SQL_MED_BUFSIZ];
+   struct tm *stime = localtime(&start_time.tv_sec);
+-  snprintf( sql, sizeof(sql), "INSERT INTO Events ( MonitorId, StorageId, Name, StartTime, Width, Height, Cause, Notes, StateId, Orientation, Videoed, DefaultVideo, SaveJPEGs, Scheme ) values ( %d, %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s', %d, %d, %d, '', %d, '%s' )",
++  snprintf( sql, sizeof(sql), "INSERT INTO Events ( MonitorId, StorageId, Name, StartTime, Width, Height, Cause, Notes, StateId, Orientation, Videoed, DefaultVideo, SaveJPEGs, Scheme ) values ( %d, %d, 'New Event', from_unixtime( %jd ), %d, %d, '%s', '%s', %d, %d, %d, '', %d, '%s' )",
+       monitor->Id(), 
+       storage->Id(),
+-      start_time.tv_sec,
++      (intmax_t) start_time.tv_sec,
+       monitor->Width(),
+       monitor->Height(),
+       cause.c_str(),
+@@ -247,8 +247,8 @@ Event::~Event() {
+   if ( frames > last_db_frame ) {
+     Debug(1, "Adding closing frame %d to DB", frames);
+     snprintf(sql, sizeof(sql), 
+-        "INSERT INTO Frames ( EventId, FrameId, TimeStamp, Delta ) VALUES ( %" PRIu64 ", %d, from_unixtime( %ld ), %s%ld.%02ld )",
+-        id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec);
++        "INSERT INTO Frames ( EventId, FrameId, TimeStamp, Delta ) VALUES ( %" PRIu64 ", %d, from_unixtime( %jd ), %s%jd.%02ld )",
++        id, frames, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec);
+     db_mutex.lock();
+     if ( mysql_query(&dbconn, sql) ) {
+       Error("Can't insert frame: %s", mysql_error(&dbconn));
+@@ -259,8 +259,8 @@ Event::~Event() {
+   }
  
--  snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
-+  snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %jd ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
-   if ( mysql_query( &dbconn, sql ) )
-   {
-     Error( "Can't update event: %s", mysql_error( &dbconn ) );
-@@ -525,7 +527,7 @@ void Event::AddFramesInternal( int n_fra
+   snprintf(sql, sizeof(sql), 
+-      "UPDATE Events SET Name='%s %" PRIu64 "', EndTime = from_unixtime( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d, DefaultVideo = '%s' WHERE Id = %" PRIu64,
+-      monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, video_name, id );
++      "UPDATE Events SET Name='%s %" PRIu64 "', EndTime = from_unixtime( %jd ), Length = %s%jd.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d, DefaultVideo = '%s' WHERE Id = %" PRIu64,
++      monitor->EventPrefix(), id, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, video_name, id );
+   db_mutex.lock();
+   while ( mysql_query(&dbconn, sql) && !zm_terminate ) {
+     Error("Can't update event: %s reason: %s", sql, mysql_error(&dbconn));
+@@ -479,13 +479,13 @@ void Event::AddFramesInternal( int n_fra
      DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_2 );
+     // Delta is Decimal(8,2) so 6 integer digits and 2 decimal digits
+     if ( delta_time.sec > 999999 ) {
+-      Warning("Invalid delta_time from_unixtime(%ld), %s%ld.%02ld", 
+-           timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
++      Warning("Invalid delta_time from_unixtime(%jd), %s%jd.%02ld", 
++           (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec );
+         delta_time.sec = 0;
+     }
  
      int sql_len = strlen(sql);
--    snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%ld), %s%ld.%02ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
-+    snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%jd), %s%ld.%02ld ), ", id, frames, (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+-    snprintf(sql+sql_len, sizeof(sql)-sql_len, "( %" PRIu64 ", %d, from_unixtime(%ld), %s%ld.%02ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec);
++    snprintf(sql+sql_len, sizeof(sql)-sql_len, "( %" PRIu64 ", %d, from_unixtime(%jd), %s%jd.%02ld ), ", id, frames, (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec);
  
      frameCount++;
-   }
-@@ -576,7 +578,7 @@ void Event::AddFrame( Image *image, stru
- 
-     Debug( 1, "Adding frame %d of type \"%s\" to DB", frames, frame_type );
+   } // end foreach frame
+@@ -548,8 +548,8 @@ Debug(3, "Writing video");
      static char sql[ZM_SQL_MED_BUFSIZ];
--    snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type, timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
-+    snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %jd ), %s%jd.%02ld, %d )", id, frames, frame_type, (intmax_t) timestamp.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec, score );
-     if ( mysql_query( &dbconn, sql ) )
-     {
-       Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
-@@ -664,7 +666,7 @@ bool EventStream::loadInitialEventData( 
- {
-   static char sql[ZM_SQL_SML_BUFSIZ];
- 
--  snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %d and unix_timestamp( EndTime ) > %ld order by Id asc limit 1", monitor_id, event_time );
-+  snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %d and unix_timestamp( EndTime ) > %jd order by Id asc limit 1", monitor_id, (intmax_t) event_time );
- 
-   if ( mysql_query( &dbconn, sql ) )
-   {
-@@ -1222,7 +1224,9 @@ bool EventStream::sendFrame( int delta_u
-   Debug( 2, "Sending frame %d", curr_frame_id );
- 
-   static char filepath[PATH_MAX];
-+#if HAVE_SENDFILE
-   static struct stat filestat;
-+#endif
-   FILE *fdj = NULL;
-   
-   snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
+     snprintf(sql, sizeof(sql),
+         "INSERT INTO Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score )"
+-        " VALUES ( %" PRIu64 ", %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )",
+-        id, frames, frame_type_names[frame_type], timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score);
++        " VALUES ( %" PRIu64 ", %d, '%s', from_unixtime( %jd ), %s%ld.%02jd, %d )",
++        id, frames, frame_type_names[frame_type], (intmax_t) timestamp.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec, score);
+     db_mutex.lock();
+     if ( mysql_query(&dbconn, sql) ) {
+       Error("Can't insert frame: %s", mysql_error(&dbconn));
+@@ -563,9 +563,9 @@ Debug(3, "Writing video");
+     // We are writing a Bulk frame
+     if ( frame_type == BULK ) {
+       snprintf(sql, sizeof(sql), 
+-          "UPDATE Events SET Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %" PRIu64, 
++          "UPDATE Events SET Length = %s%jd.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %" PRIu64, 
+           ( delta_time.positive?"":"-" ),
+-          delta_time.sec, delta_time.fsec,
++          (intmax_t) delta_time.sec, delta_time.fsec,
+           frames, 
+           alarm_frames,
+           tot_score,
diff --git a/zoneminder/patches/patch-src_zm__monitor.cpp b/zoneminder/patches/patch-src_zm__monitor.cpp
index 983d86480e..15d961fe42 100644
--- a/zoneminder/patches/patch-src_zm__monitor.cpp
+++ b/zoneminder/patches/patch-src_zm__monitor.cpp
@@ -7,27 +7,27 @@ particular values that might make sense.
 
 Avoid type error (suseconds_t is not long).  To be addressed upstream once caught up.
 
---- src/zm_monitor.cpp.orig	2019-02-23 04:38:47.000000000 +1300
-+++ src/zm_monitor.cpp	2022-01-19 21:56:47.000000000 +1300
-@@ -160,7 +160,7 @@
+--- src/zm_monitor.cpp.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_monitor.cpp
+@@ -180,7 +180,7 @@ bool Monitor::MonitorLink::connect() {
        return( false );
      }
      mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
--    if ( mem_ptr < 0 )
-+    if ( mem_ptr == (void *)-1 )
-     {
+-    if ( mem_ptr < (void *)0 ) {
++    if ( mem_ptr == (void *)-1 ) {
        Debug( 3, "Can't shmat link memory: %s", strerror(errno) );
        connected = false;
-@@ -194,7 +194,7 @@
+       return( false );
+@@ -210,7 +210,7 @@ bool Monitor::MonitorLink::disconnect() 
      connected = false;
  
  #if ZM_MEM_MAPPED
--    if ( mem_ptr > 0 )
-+    if ( mem_ptr != 0 && mem_ptr != (void *)-1 )
-     {
+-    if ( mem_ptr > (void *)0 ) {
++    if ( mem_ptr != (void *)0 && mem_ptr != (void *)-1) {
        msync( mem_ptr, mem_size, MS_ASYNC );
        munmap( mem_ptr, mem_size );
-@@ -3175,7 +3175,7 @@
+     }
+@@ -2531,7 +2531,7 @@ void Monitor::TimestampImage( Image *ts_
              found_macro = true;
              break;
            case 'f' :
diff --git a/zoneminder/patches/patch-src_zm__rtp__source.cpp b/zoneminder/patches/patch-src_zm__rtp__source.cpp
index 834d7ceb60..a8efba866a 100644
--- a/zoneminder/patches/patch-src_zm__rtp__source.cpp
+++ b/zoneminder/patches/patch-src_zm__rtp__source.cpp
@@ -2,15 +2,15 @@ $NetBSD: patch-src_zm__rtp__source.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
 
 Fix type issue with tv_sec; see earlier patches.
 
---- src/zm_rtp_source.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_rtp_source.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_rtp_source.cpp
 @@ -197,7 +197,7 @@ void RtpSource::updateRtcpData( uint32_t
  {
    struct timeval ntpTime = tvMake( ntpTimeSecs, suseconds_t((USEC_PER_SEC*(ntpTimeFrac>>16))/(1<<16)) );
  
 -  Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
-+  Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec,ntpTime.tv_usec, rtpTime );
-                            
++  Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
+ 
    if ( mBaseTimeNtp.tv_sec == 0 )
    {
 @@ -207,8 +207,8 @@ void RtpSource::updateRtcpData( uint32_t
diff --git a/zoneminder/patches/patch-src_zm__thread.h b/zoneminder/patches/patch-src_zm__thread.h
index c2ae453bae..e021910c84 100644
--- a/zoneminder/patches/patch-src_zm__thread.h
+++ b/zoneminder/patches/patch-src_zm__thread.h
@@ -8,9 +8,9 @@ portable than syscall(SYS_gettid).
 
 \todo Fix correctly upstream.
 
---- src/zm_thread.h.orig	2019-02-23 04:38:47.000000000 +1300
-+++ src/zm_thread.h	2022-01-18 00:14:30.000000000 +1300
-@@ -22,20 +22,21 @@
+--- src/zm_thread.h.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_thread.h
+@@ -22,10 +22,8 @@
  
  #include <unistd.h>
  #include <pthread.h>
@@ -22,31 +22,25 @@ portable than syscall(SYS_gettid).
  #include "zm_exception.h"
  #include "zm_utils.h"
  #ifdef __FreeBSD__
- #include <sys/thr.h>
- #endif
+@@ -34,7 +32,7 @@
  
-+/* Assume that because pthread.h was included, all systems have pthread.*/
-+#define USE_PTHREAD
-+
- class ThreadException : public Exception
- {
+ class ThreadException : public Exception {
  private:
 -#ifndef SOLARIS
 +#ifndef USE_PTHREAD
    pid_t pid() {
      pid_t tid; 
  #ifdef __FreeBSD__ 
-@@ -55,7 +56,8 @@
+@@ -54,7 +52,7 @@ private:
    pthread_t pid() { return( pthread_self() ); }
  #endif
  public:
--  ThreadException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)pid() ) ) {
-+  /* The type of pid() varies by OS */
-+  ThreadException( const std::string &message ) : Exception( stringtf( ("(%jd) "+message).c_str(), (intmax_t)pid() ) ) {
+-  explicit ThreadException( const std::string &message ) : Exception( stringtf("(%d) ", (long int)pid())+message ) {
++  explicit ThreadException( const std::string &message ) : Exception( stringtf("(%jd) ", (intmax_t)pid())+message ) {
    }
  };
  
-@@ -217,7 +219,7 @@
+@@ -209,7 +207,7 @@ protected:
  
    Mutex mThreadMutex;
    Condition mThreadCondition;
@@ -55,21 +49,21 @@ portable than syscall(SYS_gettid).
    pid_t mPid;
  #else
    pthread_t mPid;
-@@ -230,7 +232,7 @@
+@@ -222,7 +220,7 @@ protected:
    Thread();
    virtual ~Thread();
  
 -#ifndef SOLARIS
 +#ifndef USE_PTHREAD
-   pid_t id() const
-   {
+   pid_t id() const {
      pid_t tid; 
-@@ -269,7 +271,7 @@
+ #ifdef __FreeBSD__ 
+@@ -257,7 +255,7 @@ public:
+   void join();
    void kill( int signal );
-   bool isThread()
-   {
+   bool isThread() {
 -    return( mPid > -1 && pthread_equal( pthread_self(), mThread ) );
 +    return( /* mPid > -1 && */ pthread_equal( pthread_self(), mThread ) );
    }
-   bool isStarted() const { return( mStarted ); }
-   bool isRunning() const { return( mRunning ); }
+   bool isStarted() const { return mStarted; }
+   bool isRunning() const { return mRunning; }
diff --git a/zoneminder/patches/patch-src_zm__timer.h b/zoneminder/patches/patch-src_zm__timer.h
index d285fdb412..c2a3552da3 100644
--- a/zoneminder/patches/patch-src_zm__timer.h
+++ b/zoneminder/patches/patch-src_zm__timer.h
@@ -6,7 +6,7 @@ pthread_t is opaque, and under NetBSD is a pointer.  It's being abused here,
 but the value is only used for logging, and casting pthread_self() is more
 portable than syscall(SYS_gettid).
 
---- src/zm_timer.h.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_timer.h.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_timer.h
 @@ -33,7 +33,7 @@ private:
    class TimerException : public Exception
@@ -21,8 +21,8 @@ portable than syscall(SYS_gettid).
    pthread_t pid() { return( pthread_self() ); }
  #endif
    public:
--    TimerException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)pid() ) )
-+    TimerException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (long int)pid() ) )
-     {
+-    explicit TimerException( const std::string &message ) : Exception( stringtf("(%d) ", (long int)pid())+message ) {
++    explicit TimerException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (long int)pid() ) )
      }
    };
+ 
diff --git a/zoneminder/patches/patch-src_zm__utils.cpp b/zoneminder/patches/patch-src_zm__utils.cpp
index 9dd9ccb704..f5b94086a2 100644
--- a/zoneminder/patches/patch-src_zm__utils.cpp
+++ b/zoneminder/patches/patch-src_zm__utils.cpp
@@ -2,20 +2,20 @@ $NetBSD: patch-src_zm__utils.cpp,v 1.1 2013/03/24 16:47:47 joerg Exp $
 
 \todo Explain
 
---- src/zm_utils.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_utils.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_utils.cpp
-@@ -76,21 +76,6 @@ const std::string stringtf( const char *
-   return( tempString );
+@@ -66,21 +66,6 @@ std::string replaceAll(std::string str, 
+   return str;
  }
  
--const std::string stringtf( const std::string &format, ... )
+-const std::string stringtf( const char *format, ... )
 -{
 -  va_list ap;
 -  char tempBuffer[8192];
 -  std::string tempString;
 -
 -  va_start(ap, format );
--  vsnprintf( tempBuffer, sizeof(tempBuffer), format.c_str() , ap );
+-  vsnprintf( tempBuffer, sizeof(tempBuffer), format , ap );
 -  va_end(ap);
 -
 -  tempString = tempBuffer;
@@ -23,6 +23,6 @@ $NetBSD: patch-src_zm__utils.cpp,v 1.1 2013/03/24 16:47:47 joerg Exp $
 -  return( tempString );
 -}
 -
- bool startsWith( const std::string &haystack, const std::string &needle )
+ const std::string stringtf( const std::string format, ... )
  {
-   return( haystack.substr( 0, needle.length() ) == needle );
+   va_list ap;
diff --git a/zoneminder/patches/patch-src_zm__utils.h b/zoneminder/patches/patch-src_zm__utils.h
index 41578784f0..96af7dae0c 100644
--- a/zoneminder/patches/patch-src_zm__utils.h
+++ b/zoneminder/patches/patch-src_zm__utils.h
@@ -2,13 +2,13 @@ $NetBSD: patch-src_zm__utils.h,v 1.2 2015/04/05 08:51:08 dsainty Exp $
 
 \todo Explain
 
---- src/zm_utils.h.orig	2015-04-01 17:20:39.840273017 +1300
-+++ src/zm_utils.h	2015-04-01 17:28:57.376293647 +1300
-@@ -33,7 +33,6 @@
+--- src/zm_utils.h.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_utils.h
+@@ -33,7 +33,6 @@ std::string trimSet(std::string str, std
  std::string replaceAll(std::string str, std::string from, std::string to);
  
  const std::string stringtf( const char *format, ... );
 -const std::string stringtf( const std::string &format, ... );
  
  bool startsWith( const std::string &haystack, const std::string &needle );
- StringVector split( const std::string &string, const std::string chars, int limit=0 );
+ StringVector split( const std::string &string, const std::string &chars, int limit=0 );
diff --git a/zoneminder/patches/patch-src_zm_comms_h b/zoneminder/patches/patch-src_zm_comms_h
index a397459bc0..b1775204d1 100644
--- a/zoneminder/patches/patch-src_zm_comms_h
+++ b/zoneminder/patches/patch-src_zm_comms_h
@@ -7,7 +7,7 @@ Include missing system headers for NetBSD.
 To fix Linux readv/writev, back-port:
 https://github.com/ZoneMinder/zoneminder/commit/417421b1d869d1b71c8ec1a1e3b082fcede6ce58#diff-484f666f58ec13f38fa402143f2f6ad8e63a013909d3941ffbb3d66745b20c8d
 
---- src/zm_comms.h.orig	2016-02-03 18:40:30.000000000 +0000
+--- src/zm_comms.h.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_comms.h
 @@ -22,20 +22,24 @@
  
@@ -24,10 +24,9 @@ https://github.com/ZoneMinder/zoneminder/commit/417421b1d869d1b71c8ec1a1e3b082fc
 -#include <vector>
 +#include <stdlib.h>
 +#include <time.h>
-+#include <sys/uio.h>
+ #include <sys/uio.h>
  
  #if defined(BSD)
--#include <sys/uio.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
  #endif
@@ -36,5 +35,5 @@ https://github.com/ZoneMinder/zoneminder/commit/417421b1d869d1b71c8ec1a1e3b082fc
 +#include <set>
 +#include <vector>
  
- class CommsException : public Exception
- {
+ class CommsException : public Exception {
+ public:
diff --git a/zoneminder/patches/patch-src_zm_logger_cpp b/zoneminder/patches/patch-src_zm_logger_cpp
index 01d3d78064..99c7c813c3 100644
--- a/zoneminder/patches/patch-src_zm_logger_cpp
+++ b/zoneminder/patches/patch-src_zm_logger_cpp
@@ -9,54 +9,25 @@ to use SYS_gettid.
 
 Fix time types (sizes).
 
---- src/zm_logger.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_logger.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_logger.cpp
-@@ -33,9 +33,11 @@
- #include <errno.h>
- #ifdef __FreeBSD__
- #include <sys/thr.h>
--#include <libgen.h>
- #endif
- 
-+/* POSIX specifies libgen.h for basename() */
-+#include <libgen.h>
-+
- bool Logger::smInitialised = false;
- Logger *Logger::smInstance = 0;
- 
-@@ -515,7 +517,8 @@ void Logger::logPrint( bool hex, const c
-     va_list     argPtr;
-     struct timeval  timeVal;
+@@ -464,7 +464,7 @@ void Logger::logPrint( bool hex, const c
  
--    const char * const file = basename(filepath);
-+    /* \todo Verify that the cast is safe. */
-+    const char * const file = basename((char *)filepath);
-     
-     if ( level < PANIC || level > DEBUG9 )
-       Panic( "Invalid logger level %d", level );
-@@ -531,14 +534,14 @@ void Logger::logPrint( bool hex, const c
+     subtractTime( &timeVal, &logStart );
  
-       subtractTime( &timeVal, &logStart );
- 
--      snprintf( timeString, sizeof(timeString), "%ld.%03ld", timeVal.tv_sec, timeVal.tv_usec/1000 );
-+      snprintf( timeString, sizeof(timeString), "%jd.%03ld", (intmax_t) timeVal.tv_sec, timeVal.tv_usec/1000 );
-     }
-     else
-     {
-   #endif
-       char *timePtr = timeString;
-       timePtr += strftime( timePtr, sizeof(timeString), "%x %H:%M:%S", localtime(&timeVal.tv_sec) );
--      snprintf( timePtr, sizeof(timeString)-(timePtr-timeString), ".%06ld", timeVal.tv_usec );
-+      snprintf( timePtr, sizeof(timeString)-(timePtr-timeString), ".%06jd", (intmax_t) timeVal.tv_usec );
-   #if 0
-     }
-   #endif
-@@ -615,7 +618,7 @@ void Logger::logPrint( bool hex, const c
- 
-       mysql_real_escape_string( &mDbConnection, escapedString, syslogStart, strlen(syslogStart) );
-       
--      snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) values ( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )", timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line );
-+      snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) values ( %jd.%06jd, '%s', %d, %d, %d, '%s', '%s', '%s', %d )", (intmax_t) timeVal.tv_sec, (intmax_t) timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line );
-       if ( mysql_query( &mDbConnection, sql ) )
-       {
+-    snprintf( timeString, sizeof(timeString), "%ld.%03ld", timeVal.tv_sec, timeVal.tv_usec/1000 );
++    snprintf( timeString, sizeof(timeString), "%jd.%03ld", (intmax_t) timeVal.tv_sec, timeVal.tv_usec/1000 );
+   } else {
+ #endif
+     char *timePtr = timeString;
+@@ -548,8 +548,8 @@ void Logger::logPrint( bool hex, const c
+           "INSERT INTO Logs "
+           "( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line )"
+          " VALUES "
+-         "( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
+-         timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
++         "( %jd.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
++         (intmax_t) timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
+          );
+       if ( mysql_query(&dbconn, sql) ) {
          Level tempDatabaseLevel = mDatabaseLevel;
diff --git a/zoneminder/patches/patch-src_zm_remote_camera_h b/zoneminder/patches/patch-src_zm_remote_camera_h
index 1bdc9b675b..09fa3f6b02 100644
--- a/zoneminder/patches/patch-src_zm_remote_camera_h
+++ b/zoneminder/patches/patch-src_zm_remote_camera_h
@@ -2,19 +2,21 @@ $NetBSD: patch-src_zm_remote_camera_h,v 1.4 2015/04/05 08:51:08 dsainty Exp $
 
 Declare sockaddr_in.
 
---- src/zm_remote_camera.h.orig	2015-02-05 15:52:37.000000000 +1300
-+++ src/zm_remote_camera.h	2015-04-01 17:56:10.736361360 +1300
-@@ -23,10 +23,13 @@
+--- src/zm_remote_camera.h.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_remote_camera.h
+@@ -23,11 +23,15 @@
  #include "zm_camera.h"
  #include "zm_rtsp_auth.h"
  
-+#include <netinet/in.h>
++
 +
  #include <string>
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netdb.h>
++#include <netinet/in.h>
+ #include <arpa/inet.h>
 +#include <time.h>
  
- //
- // Class representing 'remote' cameras, i.e. those which are
+ #define SOCKET_BUF_SIZE 8192
+ 
diff --git a/zoneminder/patches/patch-src_zm_signal_cpp b/zoneminder/patches/patch-src_zm_signal_cpp
index 9ca264a583..6387927e92 100644
--- a/zoneminder/patches/patch-src_zm_signal_cpp
+++ b/zoneminder/patches/patch-src_zm_signal_cpp
@@ -6,10 +6,10 @@ platform except Linux.  Only Linux is sure to have this style of mcontext_t.
 Resolves build on systems that have ucontext_t but an mcontext_t that
 doesn't look like Linux.
 
---- src/zm_signal.cpp.orig	2019-02-23 04:38:47.000000000 +1300
-+++ src/zm_signal.cpp	2022-01-18 00:42:50.000000000 +1300
-@@ -66,13 +66,17 @@
- 	    #ifdef __FreeBSD_kernel__
+--- src/zm_signal.cpp.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_signal.cpp
+@@ -66,13 +66,17 @@ RETSIGTYPE zm_die_handler(int signal)
+ 	    #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) 
  		ip = (void *)(uc->uc_mcontext.mc_rip);
  	    #else
 +		#if defined(__linux__)
@@ -17,7 +17,7 @@ doesn't look like Linux.
 +		#endif
  	    #endif
      #else
- 	    #ifdef __FreeBSD_kernel__
+ 	    #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
  		ip = (void *)(uc->uc_mcontext.mc_eip);
  	    #else
 +		#if defined(__linux__)
diff --git a/zoneminder/patches/patch-src_zm_thread_cpp b/zoneminder/patches/patch-src_zm_thread_cpp
index 778643a245..bb432ddedf 100644
--- a/zoneminder/patches/patch-src_zm_thread_cpp
+++ b/zoneminder/patches/patch-src_zm_thread_cpp
@@ -5,26 +5,26 @@ in ZoneMinder.
 
 Work around varying notion of an undefined mpid on pthread/not.
 
---- src/zm_thread.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zm_thread.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_thread.cpp
-@@ -72,6 +72,7 @@ void Mutex::lock()
+@@ -69,6 +69,7 @@ void Mutex::lock() {
      throw ThreadException( stringtf( "Unable to lock pthread mutex: %s", strerror(errno) ) );
  }
  
 +#if 0
- void Mutex::lock( int secs )
- {
+ void Mutex::lock( int secs ) {
    struct timespec timeout = getTimeout( secs );
-@@ -85,6 +86,7 @@ void Mutex::lock( double secs )
+   if ( pthread_mutex_timedlock( &mMutex, &timeout ) < 0 )
+@@ -80,6 +81,7 @@ void Mutex::lock( double secs ) {
    if ( pthread_mutex_timedlock( &mMutex, &timeout ) < 0 )
      throw ThreadException( stringtf( "Unable to timedlock pthread mutex: %s", strerror(errno) ) );
  }
 +#endif
  
- void Mutex::unlock()
- {
-@@ -232,9 +234,15 @@ template <class T> void ThreadData<T>::u
-   Debug( 9, "Updated value, %p", this );
+ void Mutex::unlock() {
+   if ( pthread_mutex_unlock( &mMutex ) < 0 )
+@@ -218,9 +220,15 @@ template <class T> void ThreadData<T>::u
+   Debug(9, "Updated value, %p", this);
  }
  
 +#ifndef USE_PTHREAD
@@ -40,16 +40,16 @@ Work around varying notion of an undefined mpid on pthread/not.
    mStarted( false ),
    mRunning( false )
  {
-@@ -307,7 +315,7 @@ void Thread::join()
+@@ -283,7 +291,7 @@ void Thread::join() {
    if ( isThread() )
      throw ThreadException( "Can't self join thread" );
    mThreadMutex.lock();
--  if ( mPid >= 0 )
-+  if ( mPid != MPID_UNDEFINED )
-   {
-     if ( mStarted )
-     {
-@@ -336,4 +344,5 @@ void Thread::kill( int signal )
+-  if ( mPid >= 0 ) {
++  if ( mPid != MPID_UNDEFINED ) {
+     if ( mStarted ) {
+       void *threadStatus = 0;
+       if ( pthread_join( mThread, &threadStatus ) < 0 )
+@@ -305,4 +313,5 @@ void Thread::kill( int signal ) {
  }
  
  // Some explicit template instantiations
diff --git a/zoneminder/patches/patch-src_zmc_cpp b/zoneminder/patches/patch-src_zmc_cpp
index 2398362bd3..128843a3d7 100644
--- a/zoneminder/patches/patch-src_zmc_cpp
+++ b/zoneminder/patches/patch-src_zmc_cpp
@@ -3,7 +3,7 @@ $NetBSD: patch-src_zmc_cpp,v 1.2 2013/03/24 16:47:47 joerg Exp $
 Use a more appropriate initialisation for a long, and use the definition out
 of <limits.h>, for portability.
 
---- src/zmc.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zmc.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zmc.cpp
 @@ -55,7 +55,7 @@ possible, this should run at more or les
  
@@ -14,12 +14,12 @@ of <limits.h>, for portability.
  #include <limits.h>
  #else
  #include <values.h>
-@@ -280,7 +280,7 @@ int main( int argc, char *argv[] )
-     sigprocmask( SIG_BLOCK, &block_set, 0 );
-     for ( int i = 0; i < n_monitors; i++ )
-     {
--      long min_delay = MAXINT;
-+      long min_delay = LONG_MAX;
+@@ -278,7 +278,7 @@ int main(int argc, char *argv[]) {
+     while ( !zm_terminate ) {
+       sigprocmask(SIG_BLOCK, &block_set, 0);
+       for ( int i = 0; i < n_monitors; i++ ) {
+-        long min_delay = MAXINT;
++        long min_delay = LONG_MAX;
  
-       gettimeofday( &now, NULL );
-       for ( int j = 0; j < n_monitors; j++ )
+         gettimeofday(&now, NULL);
+         for ( int j = 0; j < n_monitors; j++ ) {
diff --git a/zoneminder/patches/patch-src_zmu.cpp b/zoneminder/patches/patch-src_zmu.cpp
index 36a79a18e3..ec6d24ad64 100644
--- a/zoneminder/patches/patch-src_zmu.cpp
+++ b/zoneminder/patches/patch-src_zmu.cpp
@@ -2,9 +2,9 @@ $NetBSD: patch-src_zmu.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
 
 time types
 
---- src/zmu.cpp.orig	2019-02-22 15:38:47.000000000 +0000
+--- src/zmu.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zmu.cpp
-@@ -519,14 +519,14 @@ int main( int argc, char *argv[] )
+@@ -494,12 +494,12 @@ int main(int argc, char *argv[]) {
            if ( timestamp.tv_sec )
              strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( &timestamp.tv_sec ) );
            if ( image_idx == -1 )
@@ -13,33 +13,31 @@ time types
            else
 -            printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, timestamp.tv_usec/10000 );
 +            printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, (long) timestamp.tv_usec/10000 );
-         }
-         else
-         {
+         } else {
            if ( have_output ) printf( "%c", separator );
 -          printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 );
-+          printf( "%jd.%02ld", (intmax_t) timestamp.tv_sec, (long) timestamp.tv_usec/10000 );
++          printf( "%ld.%02ld", timestamp.tv_sec, (long) timestamp.tv_usec/10000 );
            have_output = true;
          }
        }
-@@ -792,12 +792,12 @@ int main( int argc, char *argv[] )
-             if ( monitor && monitor->connect() )
-             {
+@@ -718,12 +718,12 @@ int main(int argc, char *argv[]) {
+             Monitor *monitor = Monitor::Load( mon_id, false, Monitor::QUERY );
+             if ( monitor && monitor->connect() ) {
                struct timeval tv = monitor->GetTimestamp();
--              printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
-+              printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8d%8.2f\n",
+-              printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8" PRIu64 "%8.2f\n",
++              printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8" PRIu64 "%8.2f\n",
                  monitor->Id(),
                  function,
                  monitor->GetState(),
                  monitor->GetTriggerState(),
 -                tv.tv_sec, tv.tv_usec/10000,
-+		(intmax_t) tv.tv_sec, (long) tv.tv_usec/10000,
++                (intmax_t) tv.tv_sec, tv.tv_usec/10000,
                  monitor->GetLastReadIndex(),
                  monitor->GetLastWriteIndex(),
-                 monitor->GetLastEvent(),
-@@ -809,12 +809,12 @@ int main( int argc, char *argv[] )
-           else
-           {
+                 monitor->GetLastEventId(),
+@@ -733,12 +733,12 @@ int main(int argc, char *argv[]) {
+             }
+           } else {
              struct timeval tv = { 0, 0 };
 -            printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
 +            printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8d%8.2f\n",
@@ -48,7 +46,7 @@ time types
                0,
                0,
 -              tv.tv_sec, tv.tv_usec/10000,
-+	      (intmax_t) tv.tv_sec, (long) tv.tv_usec/10000,
++              (intmax_t) tv.tv_sec, tv.tv_usec/10000,
                0,
                0,
                0,
diff --git a/zoneminder/patches/patch-web_ajax_stream_php b/zoneminder/patches/patch-web_ajax_stream_php
deleted file mode 100644
index cb0044d5d5..0000000000
--- a/zoneminder/patches/patch-web_ajax_stream_php
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-web_ajax_stream_php,v 1.2 2013/03/24 16:47:47 joerg Exp $
-
-http://www.zoneminder.com/forums/viewtopic.php?t=13322
-
---- web/ajax/stream.php.orig	2011-06-27 11:14:00.000000000 +0000
-+++ web/ajax/stream.php
-@@ -60,7 +60,7 @@ $wSockets = NULL;
- $eSockets = NULL;
- $numSockets = @socket_select( $rSockets, $wSockets, $eSockets, intval(MSG_TIMEOUT/1000), (MSG_TIMEOUT%1000)*1000 );
- 
--if ( $numSockets === false )
-+if ( $numSockets === false || $numSockets < 0)
- {
-     ajaxError( "socket_select failed: ".socket_strerror(socket_last_error()) );
- }


Home | Main Index | Thread Index | Old Index