From 590697bd807ab9a74d605122ef0be4a094db9605 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Wed, 27 Jul 2022 12:19:16 -0400 Subject: [PATCH 1/2] Add padding to shared_data to re-align fields on 32bit --- src/zm_monitor.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/zm_monitor.h b/src/zm_monitor.h index ecc1e373f..e36729b51 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -192,37 +192,40 @@ protected: uint8_t recording; /* +55 */ uint8_t signal; /* +56 */ uint8_t format; /* +57 */ - uint32_t imagesize; /* +58 */ - uint32_t last_frame_score; /* +62 */ - uint32_t audio_frequency; /* +66 */ - uint32_t audio_channels; /* +70 */ + uint8_t reserved1; /* +58 */ + uint8_t reserved2; /* +59 */ + uint32_t imagesize; /* +60 */ + uint32_t last_frame_score; /* +64 */ + uint32_t audio_frequency; /* +68 */ + uint32_t audio_channels; /* +72 */ + uint32_t reserved3; /* +76 */ /* ** This keeps 32bit time_t and 64bit time_t identical and compatible as long as time is before 2038. ** Shared memory layout should be identical for both 32bit and 64bit and is multiples of 16. ** Because startup_time is 64bit it may be aligned to a 64bit boundary. So it's offset SHOULD be a multiple ** of 8. Add or delete epadding's to achieve this. */ - union { /* +72 */ + union { /* +80 */ time_t startup_time; /* When the zmc process started. zmwatch uses this to see how long the process has been running without getting any images */ uint64_t extrapad1; }; - union { /* +80 */ + union { /* +88 */ time_t zmc_heartbeat_time; /* Constantly updated by zmc. Used to determine if the process is alive or hung or dead */ uint64_t extrapad2; }; - union { /* +88 */ + union { /* +96 */ time_t last_write_time; uint64_t extrapad3; }; - union { /* +96 */ + union { /* +104 */ time_t last_read_time; uint64_t extrapad4; }; - union { /* +104 */ + union { /* +112 */ time_t last_viewed_time; uint64_t extrapad5; }; - uint8_t control_state[256]; /* +112 */ + uint8_t control_state[256]; /* +120 */ char alarm_cause[256]; char video_fifo_path[64]; From a34db8bc380b8fea0730e1786c6d3240152fa939 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Wed, 27 Jul 2022 12:21:44 -0400 Subject: [PATCH 2/2] Don't hardcode db in upgrade script. --- db/zm_update-1.37.19.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/zm_update-1.37.19.sql b/db/zm_update-1.37.19.sql index 9edee9766..ec8c61a8c 100644 --- a/db/zm_update-1.37.19.sql +++ b/db/zm_update-1.37.19.sql @@ -11,7 +11,7 @@ SET @s = (SELECT IF( AND column_name = 'ONVIF_Alarm_Text' ) > 0, "SELECT 'Column ONVIF_Alarm_Text already exists in Monitors'", -"ALTER TABLE zm.Monitors ADD Onvif_Alarm_Text varchar(30) DEFAULT 'MotionAlarm' AFTER `ONVIF_Event_Listener`" +"ALTER TABLE Monitors ADD Onvif_Alarm_Text varchar(30) DEFAULT 'MotionAlarm' AFTER `ONVIF_Event_Listener`" )); PREPARE stmt FROM @s;