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: 1 Dec 2006 15:28:12 -0000	[thread overview]
Message-ID: <20061201152812.6171.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2006-12-01 15:28:12

Modified files:
	fence/fenced   : main.c 

Log message:
	group_tool dump doesn't handle partial reads/writes,
	now we always dump entire fixed size debug buffer
	bz 214540

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

--- cluster/fence/fenced/main.c	2006/11/30 23:56:03	1.39
+++ cluster/fence/fenced/main.c	2006/12/01 15:28:11	1.40
@@ -33,6 +33,43 @@
 commandline_t comline;
 struct list_head domains;
 
+static int do_write(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+ retry:
+	rv = write(fd, buf + off, count);
+	if (rv == -1 && errno == EINTR)
+		goto retry;
+	if (rv < 0)
+		return rv;
+
+	if (rv != count) {
+		count -= rv;
+		off += rv;
+		goto retry;
+	}
+	return 0;
+}
+
+/*
+static int do_read(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+	while (off < count) {
+		rv = read(fd, buf + off, count - off);
+		if (rv == 0)
+			return -1;
+		if (rv == -1 && errno == EINTR)
+			continue;
+		if (rv == -1)
+			return -1;
+		off += rv;
+	}
+	return 0;
+}
+*/
 
 static int setup_ccs(fd_t *fd)
 {
@@ -286,18 +323,18 @@
 
 static int do_dump(int ci)
 {
-	int rv, len;
+	int rv, len = DUMP_SIZE;
 
 	if (dump_wrap) {
 		len = DUMP_SIZE - dump_point;
-		rv = write(client[ci].fd, dump_buf + dump_point, len);
-		if (rv != len)
+		rv = do_write(client[ci].fd, dump_buf + dump_point, len);
+		if (rv < 0)
 			log_debug("write error %d errno %d", rv, errno);
+		len = dump_point;
 	}
-	len = dump_point;
 
-	rv = write(client[ci].fd, dump_buf, len);
-	if (rv != len)
+	rv = do_write(client[ci].fd, dump_buf, len);
+	if (rv < 0)
 		log_debug("write error %d errno %d", rv, errno);
 	return 0;
 }



             reply	other threads:[~2006-12-01 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-01 15:28 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-26 19:33 [Cluster-devel] cluster/fence/fenced main.c teigland
2007-10-01 16:32 rmccabe
2007-10-01 16:30 rmccabe
2007-08-15 20:55 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=20061201152812.6171.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).