All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8
@ 2021-07-01 17:06 Fabrice Fontaine
  2021-07-02  8:18 ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Fontaine @ 2021-07-01 17:06 UTC (permalink / raw)
  To: selinux; +Cc: Fabrice Fontaine

Fix the following build failure with gcc 4.8 which is raised since
version 3.2 and
https://github.com/SELinuxProject/selinux/commit/156dd0de5cad31e7d437c64e11a8aef027f0a691

getseuser.c:53:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++)
  ^

Fixes:
 - http://autobuild.buildroot.org/results/37eb0952a763256fbf6ef3c668f6c95fbdf2dd35

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 libselinux/utils/getseuser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libselinux/utils/getseuser.c b/libselinux/utils/getseuser.c
index ce1b7b27..34f2e887 100644
--- a/libselinux/utils/getseuser.c
+++ b/libselinux/utils/getseuser.c
@@ -9,7 +9,7 @@ int main(int argc, char **argv)
 {
 	char *seuser = NULL, *level = NULL;
 	char **contextlist;
-	int rc, n;
+	int rc, n, i;
 
 	if (argc != 3) {
 		fprintf(stderr, "usage:  %s linuxuser fromcon\n", argv[0]);
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
 	if (n == 0)
 		printf("no valid context found\n");
 
-	for (int i = 0; i < n; i++)
+	for (i = 0; i < n; i++)
 		printf("Context %d\t%s\n", i, contextlist[i]);
 
 	freeconary(contextlist);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8
  2021-07-01 17:06 [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8 Fabrice Fontaine
@ 2021-07-02  8:18 ` Nicolas Iooss
  2021-07-03 14:19   ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Iooss @ 2021-07-02  8:18 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: SElinux list

On Thu, Jul 1, 2021 at 7:06 PM Fabrice Fontaine
<fontaine.fabrice@gmail.com> wrote:
>
> Fix the following build failure with gcc 4.8 which is raised since
> version 3.2 and
> https://github.com/SELinuxProject/selinux/commit/156dd0de5cad31e7d437c64e11a8aef027f0a691
>
> getseuser.c:53:2: error: 'for' loop initial declarations are only allowed in C99 mode
>   for (int i = 0; i < n; i++)
>   ^
>
> Fixes:
>  - http://autobuild.buildroot.org/results/37eb0952a763256fbf6ef3c668f6c95fbdf2dd35
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

If nobody else has comments, I will apply this patch tomorrow.
Thanks!
Nicolas

> ---
>  libselinux/utils/getseuser.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/utils/getseuser.c b/libselinux/utils/getseuser.c
> index ce1b7b27..34f2e887 100644
> --- a/libselinux/utils/getseuser.c
> +++ b/libselinux/utils/getseuser.c
> @@ -9,7 +9,7 @@ int main(int argc, char **argv)
>  {
>         char *seuser = NULL, *level = NULL;
>         char **contextlist;
> -       int rc, n;
> +       int rc, n, i;
>
>         if (argc != 3) {
>                 fprintf(stderr, "usage:  %s linuxuser fromcon\n", argv[0]);
> @@ -50,7 +50,7 @@ int main(int argc, char **argv)
>         if (n == 0)
>                 printf("no valid context found\n");
>
> -       for (int i = 0; i < n; i++)
> +       for (i = 0; i < n; i++)
>                 printf("Context %d\t%s\n", i, contextlist[i]);
>
>         freeconary(contextlist);
> --
> 2.30.2
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8
  2021-07-02  8:18 ` Nicolas Iooss
@ 2021-07-03 14:19   ` Nicolas Iooss
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Iooss @ 2021-07-03 14:19 UTC (permalink / raw)
  To: Fabrice Fontaine, SElinux list

On Fri, Jul 2, 2021 at 10:18 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> On Thu, Jul 1, 2021 at 7:06 PM Fabrice Fontaine
> <fontaine.fabrice@gmail.com> wrote:
> >
> > Fix the following build failure with gcc 4.8 which is raised since
> > version 3.2 and
> > https://github.com/SELinuxProject/selinux/commit/156dd0de5cad31e7d437c64e11a8aef027f0a691
> >
> > getseuser.c:53:2: error: 'for' loop initial declarations are only allowed in C99 mode
> >   for (int i = 0; i < n; i++)
> >   ^
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/37eb0952a763256fbf6ef3c668f6c95fbdf2dd35
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>
> If nobody else has comments, I will apply this patch tomorrow.
> Thanks!
> Nicolas

Applied.
Thanks,
Nicolas

> > ---
> >  libselinux/utils/getseuser.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libselinux/utils/getseuser.c b/libselinux/utils/getseuser.c
> > index ce1b7b27..34f2e887 100644
> > --- a/libselinux/utils/getseuser.c
> > +++ b/libselinux/utils/getseuser.c
> > @@ -9,7 +9,7 @@ int main(int argc, char **argv)
> >  {
> >         char *seuser = NULL, *level = NULL;
> >         char **contextlist;
> > -       int rc, n;
> > +       int rc, n, i;
> >
> >         if (argc != 3) {
> >                 fprintf(stderr, "usage:  %s linuxuser fromcon\n", argv[0]);
> > @@ -50,7 +50,7 @@ int main(int argc, char **argv)
> >         if (n == 0)
> >                 printf("no valid context found\n");
> >
> > -       for (int i = 0; i < n; i++)
> > +       for (i = 0; i < n; i++)
> >                 printf("Context %d\t%s\n", i, contextlist[i]);
> >
> >         freeconary(contextlist);
> > --
> > 2.30.2
> >


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-03 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 17:06 [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8 Fabrice Fontaine
2021-07-02  8:18 ` Nicolas Iooss
2021-07-03 14:19   ` Nicolas Iooss

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.