All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Colin McCabe <cmccabe@alumni.cmu.edu>
Cc: Project Hail List <hail-devel@vger.kernel.org>,
	Jeff Garzik <jeff@garzik.org>,
	Colin McCabe <cmccabe@alumni.cmu.edu>,
	zaitcev@redhat.com
Subject: Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents
Date: Sat, 28 Nov 2009 10:58:15 -0700	[thread overview]
Message-ID: <20091128105815.7b5cd149@redhat.com> (raw)
In-Reply-To: <1259375029-22050-1-git-send-email-cmccabe@alumni.cmu.edu>

On Fri, 27 Nov 2009 18:23:49 -0800
Colin McCabe <cmccabe@alumni.cmu.edu> wrote:

> Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>
> +	if (!g_file_get_contents(fname, &buf, &len, &err)) {
> +		fprintf(stderr, "Unable to read port file: %s\n",
> +			 err->message);
> +		g_error_free(err);
> +		return -EIO;
> +	}

We should not print errors from library routines, because it
leads to double-printing (so even if you swap the fprintf to
applog, it's still not a good thing to do).

Otherwise seems fine at first blush.

BTW, speaking of double-something, here's a funny buglet:

diff --git cld/server/server.c cld-tip/server/server.c
--- cld/server/server.c
+++ cld-tip/server/server.c
@@ -722,7 +741,7 @@ static int net_open_any(void)
 
 	if (cld_srv.port_file) {
 		char portstr[7];
-		snprintf(portstr, sizeof(portstr), "%u\n", port);
+		snprintf(portstr, sizeof(portstr), "%u", port);
 		return net_write_port(cld_srv.port_file, portstr);
 	}
 	return 0;

Our PID files contain a linefeed, as a courtesy to those who
examine them from a shell. But CLD's contains two.

-- Pete

  parent reply	other threads:[~2009-11-28 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-28  2:23 [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents Colin McCabe
2009-11-28 10:37 ` Jeff Garzik
2009-11-28 10:49   ` Jeff Garzik
2009-11-28 17:58 ` Pete Zaitcev [this message]
2009-11-28 21:23   ` Jeff Garzik
2009-11-28 23:02     ` Pete Zaitcev

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=20091128105815.7b5cd149@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=cmccabe@alumni.cmu.edu \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.