On Tue, 5 Apr 2011 09:02:50 -0700
"Justin P. Mattock"<justinmattock@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxx>
Cc: Balbir Singh<balbir@xxxxxxxxxx>
Signed-off-by: Andrew Morton<akpm@xxxxxxxxxxxxxxxxxxxx>
---
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 ||
_