Package: fam
Version: 2.7.0-12
Severity: important
Tags: patch

famd: NetConnection.c++:252: void NetConnection::flush(): Assertion `ret == 
omsgList->len' failed

When the famd server is listening over a network for fam requests, a
client monitoring a large amount of files will cause the send socket
buffer for the famd server to fill, resulting in a partial write to
the socket.  famd dies on assertion failure because it assumes that it
can always send all data when writing to a socket.  The enclosed patch
allows partial sends on the socket.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (150, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages fam depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libgcc1                     1:4.1.1-21   GCC support library
ii  libstdc++6                  4.1.1-21     The GNU Standard C++ Library v3
ii  lsb-base                    3.1-23.1     Linux Standard Base 3.1 init scrip
ii  portmap                     5-26         The RPC portmapper

fam recommends no packages.

-- no debconf information

*** partial-send.patch
diff -Naur fam-2.7.0/fam-2.7.0/src/NetConnection.c++ 
fam-2.7.0-mod/fam-2.7.0/src/NetConnection.c++
--- fam-2.7.0/fam-2.7.0/src/NetConnection.c++   2003-01-18 09:18:12.000000000 
-0500
+++ fam-2.7.0-mod/fam-2.7.0/src/NetConnection.c++       2007-07-30 
12:57:19.812380334 -0400
@@ -213,6 +213,7 @@
 
     msgList_t * msg = new msgList_t;
     msg->next = NULL;
+    msg->offset = 0;
     Length len = vsnprintf(
         msg->msg + 4, MAXMSGSIZE + 1, format, args) + 1;
     va_end(args);
@@ -241,7 +242,8 @@
 {
     while (omsgList) 
     {
-       int ret = send(fd, omsgList->msg, omsgList->len, 0);
+       int ret = send(fd, omsgList->msg + omsgList->offset,
+                       omsgList->len - omsgList->offset, 0);
         if (ret < 0 && errno == EWOULDBLOCK) 
         {
             break;
@@ -249,7 +251,9 @@
         {
             if (ret >= 0) 
             {
-                assert(ret == omsgList->len);
+                omsgList->offset += ret;
+                if( omsgList->offset < omsgList->len )
+                    continue;
             } else 
             {
                 /* Since the client library can close it's fd before
diff -Naur fam-2.7.0/fam-2.7.0/src/NetConnection.h 
fam-2.7.0-mod/fam-2.7.0/src/NetConnection.h
--- fam-2.7.0/fam-2.7.0/src/NetConnection.h     2003-01-18 09:18:12.000000000 
-0500
+++ fam-2.7.0-mod/fam-2.7.0/src/NetConnection.h 2007-07-30 12:53:46.746803625 
-0400
@@ -80,6 +80,7 @@
     typedef struct msgList_s {
         char msg[MAXMSGSIZE+5];  //  + 4 for 32-bit length, + 1 for overflow
         int len;
+        int offset;
         msgList_s * next;
     } msgList_t;
     


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to