pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
zoneminder: Adjust patches
Module Name: pkgsrc-wip
Committed By: Greg Troxel <gdt%lexort.com@localhost>
Pushed By: gdt
Date: Tue Jun 18 15:20:42 2019 -0400
Changeset: fc069c225ffb62153b2e663a0eef5ac3bffe2276
Modified Files:
zoneminder/patches/patch-src_zm__event.cpp
zoneminder/patches/patch-src_zm__monitor.cpp
zoneminder/patches/patch-src_zm__thread.h
zoneminder/patches/patch-src_zm__timer.h
zoneminder/patches/patch-src_zm_logger_cpp
Log Message:
zoneminder: Adjust patches
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fc069c225ffb62153b2e663a0eef5ac3bffe2276
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
zoneminder/patches/patch-src_zm__event.cpp | 36 +++++++++++++++++++----
zoneminder/patches/patch-src_zm__monitor.cpp | 15 ++++++++--
zoneminder/patches/patch-src_zm__thread.h | 24 +++++++++++++--
zoneminder/patches/patch-src_zm__timer.h | 2 +-
zoneminder/patches/patch-src_zm_logger_cpp | 44 ++++++++++++++++++++++++++--
5 files changed, 107 insertions(+), 14 deletions(-)
diffs:
diff --git a/zoneminder/patches/patch-src_zm__event.cpp b/zoneminder/patches/patch-src_zm__event.cpp
index 2b6ac2a333..ecae329952 100644
--- a/zoneminder/patches/patch-src_zm__event.cpp
+++ b/zoneminder/patches/patch-src_zm__event.cpp
@@ -10,7 +10,21 @@ Also, this fix is expedient and probably a better fix is appropriate.
--- src/zm_event.cpp.orig 2016-02-03 18:40:30.000000000 +0000
+++ src/zm_event.cpp
-@@ -80,7 +80,7 @@ Event::Event( Monitor *p_monitor, struct
+@@ -36,11 +36,13 @@
+ #include "zm_event.h"
+ #include "zm_monitor.h"
+
++#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 );
@@ -19,7 +33,7 @@ Also, this fix is expedient and probably a better fix is appropriate.
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert event: %s", mysql_error( &dbconn ) );
-@@ -178,7 +178,7 @@ Event::~Event()
+@@ -178,7 +180,7 @@ Event::~Event()
Debug( 1, "Adding closing frame %d to DB", frames );
static char sql[ZM_SQL_SML_BUFSIZ];
@@ -28,7 +42,7 @@ Also, this fix is expedient and probably a better fix is appropriate.
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
-@@ -191,7 +191,7 @@ Event::~Event()
+@@ -191,7 +193,7 @@ Event::~Event()
struct DeltaTimeval delta_time;
DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
@@ -37,7 +51,7 @@ Also, this fix is expedient and probably a better fix is appropriate.
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't update event: %s", mysql_error( &dbconn ) );
-@@ -522,7 +522,7 @@ void Event::AddFramesInternal( int n_fra
+@@ -522,7 +524,7 @@ void Event::AddFramesInternal( int n_fra
DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_2 );
int sql_len = strlen(sql);
@@ -46,7 +60,7 @@ Also, this fix is expedient and probably a better fix is appropriate.
frameCount++;
}
-@@ -573,7 +573,7 @@ void Event::AddFrame( Image *image, stru
+@@ -573,7 +575,7 @@ void Event::AddFrame( Image *image, stru
Debug( 1, "Adding frame %d of type \"%s\" to DB", frames, frame_type );
static char sql[ZM_SQL_MED_BUFSIZ];
@@ -55,7 +69,7 @@ Also, this fix is expedient and probably a better fix is appropriate.
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
-@@ -661,7 +661,7 @@ bool EventStream::loadInitialEventData(
+@@ -661,7 +663,7 @@ bool EventStream::loadInitialEventData(
{
static char sql[ZM_SQL_SML_BUFSIZ];
@@ -64,3 +78,13 @@ Also, this fix is expedient and probably a better fix is appropriate.
if ( mysql_query( &dbconn, sql ) )
{
+@@ -1219,7 +1221,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 );
diff --git a/zoneminder/patches/patch-src_zm__monitor.cpp b/zoneminder/patches/patch-src_zm__monitor.cpp
index 5c77a884e6..7c6507198b 100644
--- a/zoneminder/patches/patch-src_zm__monitor.cpp
+++ b/zoneminder/patches/patch-src_zm__monitor.cpp
@@ -1,8 +1,8 @@
$NetBSD: patch-src_zm__monitor.cpp,v 1.1 2017/02/15 00:54:25 joerg Exp $
---- src/zm_monitor.cpp.orig 2017-02-15 00:50:20.875646245 +0000
+--- src/zm_monitor.cpp.orig 2016-02-03 18:40:30.000000000 +0000
+++ src/zm_monitor.cpp
-@@ -149,7 +149,7 @@ bool Monitor::MonitorLink::connect()
+@@ -160,7 +160,7 @@ bool Monitor::MonitorLink::connect()
return( false );
}
mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
@@ -11,7 +11,7 @@ $NetBSD: patch-src_zm__monitor.cpp,v 1.1 2017/02/15 00:54:25 joerg Exp $
{
Debug( 3, "Can't shmat link memory: %s", strerror(errno) );
connected = false;
-@@ -534,7 +534,7 @@ bool Monitor::connect() {
+@@ -558,7 +558,7 @@ bool Monitor::connect() {
exit( -1 );
}
mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
@@ -20,3 +20,12 @@ $NetBSD: patch-src_zm__monitor.cpp,v 1.1 2017/02/15 00:54:25 joerg Exp $
{
Error( "Can't shmat: %s", strerror(errno));
exit( -1 );
+@@ -3181,7 +3181,7 @@ void Monitor::TimestampImage( Image *ts_
+ found_macro = true;
+ break;
+ case 'f' :
+- d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", ts_time->tv_usec/10000 );
++ d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", (long) ts_time->tv_usec/10000 );
+ found_macro = true;
+ break;
+ }
diff --git a/zoneminder/patches/patch-src_zm__thread.h b/zoneminder/patches/patch-src_zm__thread.h
index 1d0d36d9d7..942486e8e1 100644
--- a/zoneminder/patches/patch-src_zm__thread.h
+++ b/zoneminder/patches/patch-src_zm__thread.h
@@ -29,13 +29,33 @@ portable than syscall(SYS_gettid).
pid_t pid() {
pid_t tid;
#ifdef __FreeBSD__
-@@ -55,7 +53,8 @@ pid_t pid() {
+@@ -46,7 +44,9 @@ pid_t pid() {
+ #ifdef __FreeBSD_kernel__
+ if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
+ # else
++ #ifdef linux
+ tid=syscall(SYS_gettid);
++ #endif
+ #endif
+ #endif
+ return tid;
+@@ -55,7 +55,8 @@ pid_t pid() {
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() ) ) {
++ ThreadException( const std::string &message ) : Exception( stringtf( ("(%jd) "+message).c_str(), (intmax_t)pid() ) ) {
}
};
+@@ -242,7 +243,9 @@ protected:
+ if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
+
+ #else
++ #ifdef linux
+ tid=syscall(SYS_gettid);
++ #endif
+ #endif
+ #endif
+ return tid;
diff --git a/zoneminder/patches/patch-src_zm__timer.h b/zoneminder/patches/patch-src_zm__timer.h
index b6f9c575e8..d2ea353ae3 100644
--- a/zoneminder/patches/patch-src_zm__timer.h
+++ b/zoneminder/patches/patch-src_zm__timer.h
@@ -22,7 +22,7 @@ portable than syscall(SYS_gettid).
#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, (intmax_t)pid() ) )
++ TimerException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (intmax_t)pid() ) )
{
}
};
diff --git a/zoneminder/patches/patch-src_zm_logger_cpp b/zoneminder/patches/patch-src_zm_logger_cpp
index 09d5c665c0..6254e30b2e 100644
--- a/zoneminder/patches/patch-src_zm_logger_cpp
+++ b/zoneminder/patches/patch-src_zm_logger_cpp
@@ -5,12 +5,52 @@ to use SYS_gettid.
--- src/zm_logger.cpp.orig 2016-02-03 18:40:30.000000000 +0000
+++ src/zm_logger.cpp
-@@ -604,7 +604,7 @@ void Logger::logPrint( bool hex, const c
+@@ -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;
+
+@@ -504,7 +506,8 @@ void Logger::logPrint( bool hex, const c
+ va_list argPtr;
+ struct timeval timeVal;
+
+- 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 );
+@@ -520,14 +523,14 @@ void Logger::logPrint( bool hex, const c
+
+ 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
+@@ -604,7 +607,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.%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 );
++ 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 ) )
{
databaseLevel( NOLOG );
Home |
Main Index |
Thread Index |
Old Index