<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Genanr</id>
	<title>ZoneMinder Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Genanr"/>
	<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/Special:Contributions/Genanr"/>
	<updated>2026-04-19T17:49:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Talk:ZoneMinder_1.24.2_Bugfixes&amp;diff=3670</id>
		<title>Talk:ZoneMinder 1.24.2 Bugfixes</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Talk:ZoneMinder_1.24.2_Bugfixes&amp;diff=3670"/>
		<updated>2010-02-23T23:01:42Z</updated>

		<summary type="html">&lt;p&gt;Genanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;To avoid clutter, if you want to add a fix to this page, please don&amp;#039;t copy its code directly to this page! Make a thread in User Contributions forum and add the link to this page by editing it.&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
That would be fine, unfortunately forums is not a great place for patches.  If a patch contains a long line, line wrapping becomes a problem.  The Wiki is better (no line wrapping problems), but still not very ideal, (space/tab problems).  It would be nice to have a way to upload the patch, especially for ones that are larger than 10 lines or so.  &lt;br /&gt;
&lt;br /&gt;
Andy (forum member &amp;quot;genanr&amp;quot;)&lt;/div&gt;</summary>
		<author><name>Genanr</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Talk:ZoneMinder_1.24.2_Bugfixes&amp;diff=3669</id>
		<title>Talk:ZoneMinder 1.24.2 Bugfixes</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Talk:ZoneMinder_1.24.2_Bugfixes&amp;diff=3669"/>
		<updated>2010-02-23T23:01:20Z</updated>

		<summary type="html">&lt;p&gt;Genanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid clutter, if you want to add a fix to this page, please don&amp;#039;t copy its code directly to this page! Make a thread in User Contributions forum and add the link to this page by editing it. &lt;br /&gt;
&lt;br /&gt;
That would be fine, unfortunately forums is not a great place for patches.  If a patch contains a long line, line wrapping becomes a problem.  The Wiki is better (no line wrapping problems), but still not very ideal, (space/tab problems).  It would be nice to have a way to upload the patch, especially for ones that are larger than 10 lines or so.  &lt;br /&gt;
&lt;br /&gt;
Andy (forum member &amp;quot;genanr&amp;quot;)&lt;/div&gt;</summary>
		<author><name>Genanr</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Patches&amp;diff=3657</id>
		<title>Patches</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Patches&amp;diff=3657"/>
		<updated>2010-02-18T22:37:48Z</updated>

		<summary type="html">&lt;p&gt;Genanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is where patches for problems reported in ZoneMinder will be posted. This is only for patches to version 1.22.2 and above. Patches for versions prior to 1.22.2 will have been posted in the forums.&lt;br /&gt;
&lt;br /&gt;
[[1.22.2 Patches]]&lt;br /&gt;
&lt;br /&gt;
[[1.22.3 Patches]]&lt;br /&gt;
&lt;br /&gt;
[[1.23.2 Patches]]&lt;br /&gt;
&lt;br /&gt;
[[1.24.0 Patches]]&lt;br /&gt;
&lt;br /&gt;
[[1.24.1 Patches]]&lt;br /&gt;
&lt;br /&gt;
[[1.24.2 Patches]]&lt;br /&gt;
&lt;br /&gt;
To apply any of the patches here you should do the following :-&lt;br /&gt;
*Open a command shell&lt;br /&gt;
*Download the patch and move a copy to your ZoneMinder build directory&lt;br /&gt;
*Change directory to your ZoneMinder build directory&lt;br /&gt;
*Apply the patch by typing&lt;br /&gt;
:patch -p0 &amp;lt; &amp;lt;patchfile&amp;gt;&lt;br /&gt;
*Check that the patch is applied correctly and you do not get any rejects&lt;br /&gt;
*If necessary rebuild, then reinstall&lt;br /&gt;
&lt;br /&gt;
[[Third Party Patches]]&lt;/div&gt;</summary>
		<author><name>Genanr</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=1.24.2_Patches&amp;diff=3656</id>
		<title>1.24.2 Patches</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=1.24.2_Patches&amp;diff=3656"/>
		<updated>2010-02-18T22:37:09Z</updated>

		<summary type="html">&lt;p&gt;Genanr: /* Patch to fix Incomplete frame errors in zmf.cpp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Fix Incomplete Image errors in zmf ==&lt;br /&gt;
&lt;br /&gt;
This patch changes the socket reader in zmf from a single read, to a loop read.  Incomplete reads would be reported even though the image writer wrote the whole image to the socket.  The problem was when the read went to read the image frame from the socket, all the data had not yet been written to the socket by the writer, so the reader thought there was a problem.  The loop reads from the socket until a full image frame is read, or there is an error.&lt;br /&gt;
&lt;br /&gt;
NOTE: to patch from the top level ZM source directory type : patch -lp1 &amp;lt; patchname&lt;br /&gt;
Be sure to use the -l (ell flag, ignore whitespace), otherwise it may not patch cleanly due to tabs in the original source file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--- zm/src/zmf.cpp      2010-01-04 10:52:00.000000000 -0600&lt;br /&gt;
+++ zm-andy/src/zmf.cpp 2010-02-18 16:11:18.000000000 -0600&lt;br /&gt;
@@ -231,16 +231,39 @@&lt;br /&gt;
                 }&lt;br /&gt;
                 Debug( 1, &amp;quot;Read frame header, expecting %ld bytes of image&amp;quot;, frame_header.image_length );&lt;br /&gt;
                 static unsigned char image_data[ZM_MAX_IMAGE_SIZE];&lt;br /&gt;
-                n_bytes = read( sd, image_data, frame_header.image_length );&lt;br /&gt;
-                if ( n_bytes != (ssize_t)frame_header.image_length )&lt;br /&gt;
+&lt;br /&gt;
+                // Read for pipe and loop until bytes expected have been read or an error occures&lt;br /&gt;
+                int bytes_read = 0;&lt;br /&gt;
+                do&lt;br /&gt;
                 {&lt;br /&gt;
-                        if ( n_bytes &amp;lt; 0 )&lt;br /&gt;
+                        n_bytes = read( sd, image_data+bytes_read, frame_header.image_length-bytes_read );&lt;br /&gt;
+                        if (n_bytes &amp;lt; 0) break; // break on error&lt;br /&gt;
+                        if (n_bytes &amp;lt; frame_header.image_length)&lt;br /&gt;
                         {&lt;br /&gt;
-                                Error( &amp;quot;Can&amp;#039;t read frame image data: %s&amp;quot;, strerror(errno) );&lt;br /&gt;
+                                // print some informational messages &lt;br /&gt;
+                                if (bytes_read == 0)&lt;br /&gt;
+                                {&lt;br /&gt;
+                                        Warning(&amp;quot;Image read : Short read %d bytes of %d expected bytes&amp;quot;,n_bytes,frame_header.image_length);&lt;br /&gt;
+                                }&lt;br /&gt;
+                                else if (bytes_read+n_bytes == frame_header.image_length)&lt;br /&gt;
+                                {&lt;br /&gt;
+                                        Warning(&amp;quot;Image read : Read rest of short read: %d bytes read total of %d bytes&amp;quot;,n_bytes,frame_header.image_length);&lt;br /&gt;
+                                }&lt;br /&gt;
+                                else&lt;br /&gt;
+                                {&lt;br /&gt;
+                                        Warning(&amp;quot;Image read : continuing, read %d bytes (%d so far)&amp;quot;, n_bytes, bytes_read+n_bytes);&lt;br /&gt;
+                                }&lt;br /&gt;
                         }&lt;br /&gt;
-                        else if ( n_bytes &amp;gt; 0 )&lt;br /&gt;
+                        bytes_read+= n_bytes;&lt;br /&gt;
+                } while (n_bytes&amp;gt;0 &amp;amp;&amp;amp; (bytes_read &amp;lt; (ssize_t)frame_header.image_length) );&lt;br /&gt;
+&lt;br /&gt;
+                // Print errors if there was a problem&lt;br /&gt;
+                if ( n_bytes &amp;lt; 1 )&lt;br /&gt;
+                {&lt;br /&gt;
+                        Error( &amp;quot;Only read %d bytes of %d\n&amp;quot;, bytes_read, frame_header.image_length);&lt;br /&gt;
+                        if ( n_bytes &amp;lt; 0 )&lt;br /&gt;
                         {&lt;br /&gt;
-                                Error( &amp;quot;Incomplete read of frame image data, %d bytes only&amp;quot;, n_bytes );&lt;br /&gt;
+                                Error( &amp;quot;Can&amp;#039;t read frame image data: %s&amp;quot;, strerror(errno) );&lt;br /&gt;
                         }&lt;br /&gt;
                         else&lt;br /&gt;
                         {&lt;br /&gt;
@@ -249,16 +272,18 @@&lt;br /&gt;
                         ReopenSocket( sd, monitor-&amp;gt;Id() );&lt;br /&gt;
                         continue;&lt;br /&gt;
                 }&lt;br /&gt;
+&lt;br /&gt;
                 static char subpath[PATH_MAX] = &amp;quot;&amp;quot;;&lt;br /&gt;
-        if ( config.use_deep_storage )&lt;br /&gt;
-        {&lt;br /&gt;
-            struct tm *time = localtime( &amp;amp;frame_header.event_time );&lt;br /&gt;
-            snprintf( subpath, sizeof(subpath), &amp;quot;%02d/%02d/%02d/%02d/%02d/%02d&amp;quot;, time-&amp;gt;tm_year-100, time-&amp;gt;tm_mon+1, time-&amp;gt;tm_mday, time-&amp;gt;tm_hour, time-&amp;gt;tm_min, time-&amp;gt;tm_sec );&lt;br /&gt;
-        }&lt;br /&gt;
-        else&lt;br /&gt;
-        {&lt;br /&gt;
-            snprintf( subpath, sizeof(subpath), &amp;quot;%ld&amp;quot;, frame_header.event_id );&lt;br /&gt;
-        }&lt;br /&gt;
+                if ( config.use_deep_storage )&lt;br /&gt;
+                {&lt;br /&gt;
+                    struct tm *time = localtime( &amp;amp;frame_header.event_time );&lt;br /&gt;
+                    snprintf( subpath, sizeof(subpath), &amp;quot;%02d/%02d/%02d/%02d/%02d/%02d&amp;quot;, time-&amp;gt;tm_year-100, time-&amp;gt;tm_mon+1, time-&amp;gt;tm_mday, time-&amp;gt;tm_hour, time-&amp;gt;tm_min, time-&amp;gt;tm_sec );&lt;br /&gt;
+                }&lt;br /&gt;
+                else&lt;br /&gt;
+                {&lt;br /&gt;
+                    snprintf( subpath, sizeof(subpath), &amp;quot;%ld&amp;quot;, frame_header.event_id );&lt;br /&gt;
+                }&lt;br /&gt;
+&lt;br /&gt;
                 static char path[PATH_MAX] = &amp;quot;&amp;quot;;&lt;br /&gt;
                 snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, subpath, frame_header.frame_id );&lt;br /&gt;
                 Debug( 1, &amp;quot;Got image, writing to %s&amp;quot;, path );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Andy (&amp;quot;genanr&amp;quot; forum member).&lt;/div&gt;</summary>
		<author><name>Genanr</name></author>
	</entry>
</feed>