CVSROOT:        /cvs/cluster
Module name:    cluster
Changes by:     [EMAIL PROTECTED]       2007-10-26 19:33:47

Modified files:
        fence/fenced   : main.c 

Log message:
        Improve the dumping of debug logs from daemons.
        bz 317181
        
        group_tool reads debug logs from groupd, fenced, and gfs_controld.
        The dumping code in all three daemons is now identical.  The other
        change is that the dumping function terminates the final write
        with \0, and no longer sends the entire 1MB log buffer if it's not full.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.44&r2=1.45

--- cluster/fence/fenced/main.c 2007/10/01 16:30:57     1.44
+++ cluster/fence/fenced/main.c 2007/10/26 19:33:47     1.45
@@ -338,21 +338,22 @@
                client[i].fd = -1;
 }
 
-static int do_dump(int ci)
+static int do_dump(int fd)
 {
-       int rv, len = DUMP_SIZE;
+       int len;
 
        if (dump_wrap) {
                len = DUMP_SIZE - dump_point;
-               rv = do_write(client[ci].fd, dump_buf + dump_point, len);
-               if (rv < 0)
-                       log_debug("write error %d errno %d", rv, errno);
+               do_write(fd, dump_buf + dump_point, len);
+               len = dump_point;
+       } else
                len = dump_point;
-       }
 
-       rv = do_write(client[ci].fd, dump_buf, len);
-       if (rv < 0)
-               log_debug("write error %d errno %d", rv, errno);
+       /* NUL terminate the debug string */
+       dump_buf[dump_point] = '\0';
+
+       do_write(fd, dump_buf, len);
+
        return 0;
 }
 
@@ -386,7 +387,8 @@
        else if (!strcmp(cmd, "leave"))
                rv = do_leave(name);
        else if (!strcmp(cmd, "dump")) {
-               do_dump(ci);
+               do_dump(client[ci].fd);
+               close(client[ci].fd);
                return 0;
        } else
                rv = -EINVAL;

Reply via email to