From: Jim Meyering <jim@meyering.net>
To: Project Hail <hail-devel@vger.kernel.org>
Subject: [PATCH tabled] server/server.c (net_write_port): Don't ignore write error.
Date: Thu, 23 Sep 2010 09:55:07 +0200 [thread overview]
Message-ID: <87bp7ozyg4.fsf@meyering.net> (raw)
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
next reply other threads:[~2010-09-23 7:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-23 7:55 Jim Meyering [this message]
2010-09-23 8:18 ` [PATCH tabled] server/server.c (net_write_port): Don't ignore write error Jeff Garzik
2010-09-23 8:29 ` Jim Meyering
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=87bp7ozyg4.fsf@meyering.net \
--to=jim@meyering.net \
--cc=hail-devel@vger.kernel.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