cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/fenced main.c
Date: 26 Oct 2007 19:33:47 -0000	[thread overview]
Message-ID: <20071026193347.1898.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	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	other threads:[~2007-10-26 19:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 19:33 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-01 16:32 [Cluster-devel] cluster/fence/fenced main.c rmccabe
2007-10-01 16:30 rmccabe
2007-08-15 20:55 teigland
2006-12-01 15:28 teigland
2006-12-01 15:27 teigland
2006-12-01 15:27 teigland
2006-11-30 23:58 lhh
2006-11-30 23:57 lhh
2006-11-30 23:56 lhh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071026193347.1898.qmail@sourceware.org \
    --to=teigland@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).