[gamin] bogus GAMPacket header len patch



Im sending a patch that fixes the bogus GAMPacket header size that I reported as
giving me problems on my platform.


diff -Naur gamin-0.0.11.orig/libgamin/gam_api.c gamin-0.0.11.new/libgamin/gam_api.c
--- gamin-0.0.11.orig/libgamin/gam_api.c        Sun Sep 26 21:20:04 2004
+++ gamin-0.0.11.new/libgamin/gam_api.c Fri Oct  1 10:48:04 2004
@@ -535,7 +535,7 @@
             return (-1);
        }
     }
-    tlen = sizeof(GAMPacket) - MAXPATHLEN + len;
+    tlen = GAM_PACKET_HEADER_LEN + len;
     /* We use only local socket so no need for network byte order conversion */
     req.len = (unsigned short) tlen;
     req.version = GAM_PROTO_VERSION;
@@ -756,7 +756,7 @@
         return(-1);
 
     len = strlen(filename);
-    tlen = sizeof(GAMPacket) - MAXPATHLEN + len;
+    tlen = GAM_PACKET_HEADER_LEN + len;
     /* We use only local socket so no need for network byte order conversion */
     req.len = (unsigned short) tlen;
     req.version = GAM_PROTO_VERSION;
diff -Naur gamin-0.0.11.orig/libgamin/gam_protocol.h
gamin-0.0.11.new/libgamin/gam_protocol.h
--- gamin-0.0.11.orig/libgamin/gam_protocol.h   Tue Jul 27 11:50:10 2004
+++ gamin-0.0.11.new/libgamin/gam_protocol.h    Fri Oct  1 10:48:22 2004
@@ -83,7 +83,7 @@
  *
  * convenience macro to provide the length of the packet header.
  */
-#define GAM_PACKET_HEADER_LEN (sizeof(GAMPacket) - MAXPATHLEN)
+#define GAM_PACKET_HEADER_LEN (5 * (sizeof(unsigned short)))
 
 #ifdef __cplusplus
 }
diff -Naur gamin-0.0.11.orig/server/gam_connection.c
gamin-0.0.11.new/server/gam_connection.c
--- gamin-0.0.11.orig/server/gam_connection.c   Wed Aug 18 12:53:43 2004
+++ gamin-0.0.11.new/server/gam_connection.c    Fri Oct  1 10:50:36 2004
@@ -498,7 +498,7 @@
     /*
      * prepare the packet
      */
-    tlen = sizeof(GAMPacket) - MAXPATHLEN + len;
+    tlen = GAM_PACKET_HEADER_LEN + len;
     /* We use only local socket so no need for network byte order conversion */
     req.len = (unsigned short) tlen;
     req.version = GAM_PROTO_VERSION;


-------------------------------------------------
envoyé via Webmail/IMAG !




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]