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

On 11/28/2009 12:58 PM, Pete Zaitcev wrote:
> 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.
>

Agreed... wanna wrap that in a signed-off-by?  :)

	Jeff



  reply	other threads:[~2009-11-28 21:23 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
2009-11-28 21:23   ` Jeff Garzik [this message]
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=4B1194D1.50103@garzik.org \
    --to=jeff@garzik.org \
    --cc=cmccabe@alumni.cmu.edu \
    --cc=hail-devel@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /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.