Patchwork Remove duplicate initialization of field in nscd

login
register
mail settings
Submitter Joseph Myers
Date Feb. 1, 2019, 5:39 p.m.
Message ID <alpine.DEB.2.21.1902011738210.12728@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/31280/
State New
Headers show

Comments

Joseph Myers - Feb. 1, 2019, 5:39 p.m.
I'm looking at the warnings from building glibc with -Wextra, to see
if we could use -Wextra by default, possibly with a few of its
warnings disabled, and so benefit from warnings in -Wextra but not in
-Wall.  (The vast bulk of the extra warnings so produced are from
-Wunused-parameter -Wsign-compare -Wmissing-field-initializers
-Wtype-limits, so I expect those would be disabled at least at first.)

Various miscellaneous warnings show up with -Wextra that it clearly
seems to make sense to fix independent of whether we add -Wextra to
the normal options for building glibc.  This patch fixes one:
"initialized field overwritten [-Woverride-init]" in nscd.

Tested for x86_64.

2019-02-01  Joseph Myers  <joseph@codesourcery.com>

	* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
	once.
Florian Weimer - Feb. 2, 2019, 11:50 a.m.
* Joseph Myers:

> I'm looking at the warnings from building glibc with -Wextra, to see
> if we could use -Wextra by default, possibly with a few of its
> warnings disabled, and so benefit from warnings in -Wextra but not in
> -Wall.  (The vast bulk of the extra warnings so produced are from
> -Wunused-parameter -Wsign-compare -Wmissing-field-initializers
> -Wtype-limits, so I expect those would be disabled at least at first.)
>
> Various miscellaneous warnings show up with -Wextra that it clearly
> seems to make sense to fix independent of whether we add -Wextra to
> the normal options for building glibc.  This patch fixes one:
> "initialized field overwritten [-Woverride-init]" in nscd.

Thanks for doing this.

> Tested for x86_64.
>
> 2019-02-01  Joseph Myers  <joseph@codesourcery.com>
>
> 	* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
> 	once.
>
> diff --git a/nscd/connections.c b/nscd/connections.c
> index 61cf27e24c..a9bc00de90 100644
> --- a/nscd/connections.c
> +++ b/nscd/connections.c
> @@ -227,7 +227,6 @@ static struct
>    [GETHOSTBYADDRv6] = { true, &dbs[hstdb] },
>    [SHUTDOWN] = { false, NULL },
>    [GETSTAT] = { false, NULL },
> -  [SHUTDOWN] = { false, NULL },
>    [GETFDPW] = { false, &dbs[pwddb] },
>    [GETFDGR] = { false, &dbs[grpdb] },
>    [GETFDHST] = { false, &dbs[hstdb] },

Patch looks good to me.

Florian

Patch

diff --git a/nscd/connections.c b/nscd/connections.c
index 61cf27e24c..a9bc00de90 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -227,7 +227,6 @@  static struct
   [GETHOSTBYADDRv6] = { true, &dbs[hstdb] },
   [SHUTDOWN] = { false, NULL },
   [GETSTAT] = { false, NULL },
-  [SHUTDOWN] = { false, NULL },
   [GETFDPW] = { false, &dbs[pwddb] },
   [GETFDGR] = { false, &dbs[grpdb] },
   [GETFDHST] = { false, &dbs[hstdb] },