From: Andrew Morton <akpm@linux-foundation.org>
To: "Justin P. Mattock" <justinmattock@gmail.com>
Cc: rdunlap@xenotime.net, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, Balbir Singh <balbir@in.ibm.com>
Subject: Re: [RFC]Documentation:accounting:getdelays.c Fix: warning: variable ‘i’ set but not used
Date: Tue, 12 Apr 2011 17:26:27 -0700 [thread overview]
Message-ID: <20110412172627.4e9c4339.akpm@linux-foundation.org> (raw)
In-Reply-To: <1302019370-7101-1-git-send-email-justinmattock@gmail.com>
On Tue, 5 Apr 2011 09:02:50 -0700
"Justin P. Mattock" <justinmattock@gmail.com> wrote:
> Keep in mind there is another warning with this file, but need am unsure what might be the best solution:
> Documentation/accounting/getdelays.c: In function ___get_family_id___:
> Documentation/accounting/getdelays.c:172:14: warning: variable ___rc___ set but not used [-Wunused-but-set-variable]
this?
Subject: Documentation/accounting/getdelays.c: handle sendto() failures
From: Andrew Morton <akpm@linux-foundation.org>
Documentation/accounting/getdelays.c: In function `get_family_id':
Documentation/accounting/getdelays.c:172:14: warning: variable `rc' set but not used [-Wunused-but-set-variable]
Reported-by: "Justin P. Mattock" <justinmattock@gmail.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
Documentation/accounting/getdelays.c | 2 ++
1 file changed, 2 insertions(+)
diff -puN Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-handle-sendto-failures Documentation/accounting/getdelays.c
--- a/Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-handle-sendto-failures
+++ a/Documentation/accounting/getdelays.c
@@ -177,6 +177,8 @@ static int get_family_id(int sd)
rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
CTRL_ATTR_FAMILY_NAME, (void *)name,
strlen(TASKSTATS_GENL_NAME)+1);
+ if (rc < 0)
+ return 0; /* sendto() failure? */
rep_len = recv(sd, &ans, sizeof(ans), 0);
if (ans.n.nlmsg_type == NLMSG_ERROR ||
_
next prev parent reply other threads:[~2011-04-13 0:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 16:02 Justin P. Mattock
2011-04-11 18:56 ` Randy Dunlap
2011-04-12 1:49 ` Justin P. Mattock
2011-04-13 0:26 ` Andrew Morton [this message]
2011-04-13 0:44 ` Justin P. Mattock
2011-04-13 1:18 ` Andrew Morton
2011-04-13 1:30 ` Justin P. Mattock
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=20110412172627.4e9c4339.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=justinmattock@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/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
Powered by JetHome