* [PATCH tabled] server/server.c (net_write_port): Don't ignore write error.
@ 2010-09-23 7:55 Jim Meyering
2010-09-23 8:18 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Jim Meyering @ 2010-09-23 7:55 UTC (permalink / raw)
To: Project Hail
Better safe than sorry...
Unreported write failures can be unpleasant.
I fixed the one below so that a failure indication
can propagate up the call tree. You might also want to
report the failure to stderr.
I let my editor automatically update the copyright date
and remove trailing spaces.
If you'd rather separate those from the fix,
let me know and I can adjust and resend.
From abe4be09fea8194fe0c4187c20ebaa45822c839c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 23 Sep 2010 09:38:24 +0200
Subject: [PATCH tabled] server/server.c (net_write_port): Don't ignore write error.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
server/server.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/server/server.c b/server/server.c
index 7a9fb7a..3398026 100644
--- a/server/server.c
+++ b/server/server.c
@@ -1,6 +1,6 @@
/*
- * Copyright 2008-2009 Red Hat, Inc.
+ * Copyright 2008-2010 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1613,7 +1613,7 @@ void cld_update_cb(void)
* server, the management of nodes is not in storage.c, which deals
* with the interface to Chunk and little more.
*
- * We don't even bother with registering this callback, just call it by name.
+ * We don't even bother with registering this callback, just call it by name.
*
* The return value is used to re-arm storage rescan mechanism.
*/
@@ -1847,9 +1847,12 @@ static int net_write_port(const char *port_file,
port_file, strerror(rc));
return -rc;
}
- fprintf(portf, "%s:%s\n", tabled_srv.ourhost, port);
- fclose(portf);
- return 0;
+ if (fprintf(portf, "%s:%s\n", tabled_srv.ourhost, port) < 0) {
+ rc = errno;
+ fclose(portf);
+ return -rc;
+ }
+ return fclose(portf) ? -errno : 0;
}
/*
@@ -1959,7 +1962,7 @@ static int net_open_known(const char *portstr, bool is_status)
continue;
rc = net_open_socket(res->ai_family, res->ai_socktype,
- res->ai_protocol,
+ res->ai_protocol,
res->ai_addrlen, res->ai_addr, is_status);
if (rc < 0)
goto err_out;
@@ -2348,4 +2351,3 @@ err_out:
closelog();
return rc;
}
-
--
1.7.3.234.g7bba3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH tabled] server/server.c (net_write_port): Don't ignore write error.
2010-09-23 7:55 [PATCH tabled] server/server.c (net_write_port): Don't ignore write error Jim Meyering
@ 2010-09-23 8:18 ` Jeff Garzik
2010-09-23 8:29 ` Jim Meyering
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2010-09-23 8:18 UTC (permalink / raw)
To: Jim Meyering; +Cc: Project Hail
On 09/23/2010 03:55 AM, Jim Meyering wrote:
> Better safe than sorry...
> Unreported write failures can be unpleasant.
> I fixed the one below so that a failure indication
> can propagate up the call tree. You might also want to
> report the failure to stderr.
>
> I let my editor automatically update the copyright date
> and remove trailing spaces.
> If you'd rather separate those from the fix,
> let me know and I can adjust and resend.
Patch applied, thanks.
The typical preference is to receive whitespace and other cosmetic
changes in a separate patch, thereby highlighting the functional changes.
But we're not so strict here that I would reject an otherwise useful
patch...
Also FWIW, we're not very strict about reproducing the GCC-ish
(GNU-ish?) style of "$FILENAME ($FUNCTION):" in each changelog -- though
you're certainly welcome to continue, if that's your preference.
Given that "git show $COMMIT" will give you filename and per-diff-chunk
function names, reproducing that in the git changelog entry seems
somewhat redundant. A simple, English-language summary of the change is
fine. Just a style tip, though, feel free to ignore! :)
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH tabled] server/server.c (net_write_port): Don't ignore write error.
2010-09-23 8:18 ` Jeff Garzik
@ 2010-09-23 8:29 ` Jim Meyering
0 siblings, 0 replies; 3+ messages in thread
From: Jim Meyering @ 2010-09-23 8:29 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail
Jeff Garzik wrote:
> On 09/23/2010 03:55 AM, Jim Meyering wrote:
>> Better safe than sorry...
>> Unreported write failures can be unpleasant.
>> I fixed the one below so that a failure indication
>> can propagate up the call tree. You might also want to
>> report the failure to stderr.
>>
>> I let my editor automatically update the copyright date
>> and remove trailing spaces.
>> If you'd rather separate those from the fix,
>> let me know and I can adjust and resend.
>
> Patch applied, thanks.
>
> The typical preference is to receive whitespace and other cosmetic
> changes in a separate patch, thereby highlighting the functional
> changes.
>
> But we're not so strict here that I would reject an otherwise useful
> patch...
>
> Also FWIW, we're not very strict about reproducing the GCC-ish
> (GNU-ish?) style of "$FILENAME ($FUNCTION):" in each changelog --
> though you're certainly welcome to continue, if that's your
> preference.
Yes, the function name is added automatically when I hit C-4-a.
Easy to omit from now on.
> Given that "git show $COMMIT" will give you filename and
> per-diff-chunk function names, reproducing that in the git changelog
> entry seems somewhat redundant. A simple, English-language summary of
> the change is fine. Just a style tip, though, feel free to ignore!
> :)
Tips are always most welcome. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-23 8:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 7:55 [PATCH tabled] server/server.c (net_write_port): Don't ignore write error Jim Meyering
2010-09-23 8:18 ` Jeff Garzik
2010-09-23 8:29 ` Jim Meyering
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.