mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts/bareboximd: add mode argument to open call
@ 2020-03-10 10:43 franck.jullien
  2020-03-11 15:09 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: franck.jullien @ 2020-03-10 10:43 UTC (permalink / raw)
  To: barebox

From: Franck Jullien <franck.jullien@gmail.com>

Newer gcc complain about missing mode argument when a new file is
created. This is an extract of man-pages:

 "The mode argument specifies the file mode bits be applied when
 a new file is created.  This argument must be supplied when
 O_CREAT or O_TMPFILE is specified in flags"

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 scripts/bareboximd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c
index e5000e0ae..b332d435a 100644
--- a/scripts/bareboximd.c
+++ b/scripts/bareboximd.c
@@ -59,7 +59,7 @@ static int write_file(const char *filename, const void *buf, size_t size)
 	int fd, ret;
 	int now;
 
-	fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT);
+	fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 	if (fd < 0)
 		return fd;
 
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] scripts/bareboximd: add mode argument to open call
  2020-03-10 10:43 [PATCH] scripts/bareboximd: add mode argument to open call franck.jullien
@ 2020-03-11 15:09 ` Sascha Hauer
  2020-03-11 19:42   ` Franck Jullien
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2020-03-11 15:09 UTC (permalink / raw)
  To: franck.jullien; +Cc: barebox

Hi Franck,

On Tue, Mar 10, 2020 at 11:43:48AM +0100, franck.jullien@gmail.com wrote:
> From: Franck Jullien <franck.jullien@gmail.com>
> 
> Newer gcc complain about missing mode argument when a new file is
> created. This is an extract of man-pages:
> 
>  "The mode argument specifies the file mode bits be applied when
>  a new file is created.  This argument must be supplied when
>  O_CREAT or O_TMPFILE is specified in flags"

Does this warning only show up when compiling for the host or also when
compiling barebox itself?

Sascha

> 
> Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
> ---
>  scripts/bareboximd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c
> index e5000e0ae..b332d435a 100644
> --- a/scripts/bareboximd.c
> +++ b/scripts/bareboximd.c
> @@ -59,7 +59,7 @@ static int write_file(const char *filename, const void *buf, size_t size)
>  	int fd, ret;
>  	int now;
>  
> -	fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT);
> +	fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
>  	if (fd < 0)
>  		return fd;
>  
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] scripts/bareboximd: add mode argument to open call
  2020-03-11 15:09 ` Sascha Hauer
@ 2020-03-11 19:42   ` Franck Jullien
  0 siblings, 0 replies; 3+ messages in thread
From: Franck Jullien @ 2020-03-11 19:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Le mer. 11 mars 2020 à 16:09, Sascha Hauer <s.hauer@pengutronix.de> a écrit :
>
> Hi Franck,
>
> On Tue, Mar 10, 2020 at 11:43:48AM +0100, franck.jullien@gmail.com wrote:
> > From: Franck Jullien <franck.jullien@gmail.com>
> >
> > Newer gcc complain about missing mode argument when a new file is
> > created. This is an extract of man-pages:
> >
> >  "The mode argument specifies the file mode bits be applied when
> >  a new file is created.  This argument must be supplied when
> >  O_CREAT or O_TMPFILE is specified in flags"
>
> Does this warning only show up when compiling for the host or also when
> compiling barebox itself?
>

It happens when I compile barebox itself (or something is obviously wrong):

...$ ARCH=sandbox make sandbox_defconfig
#
# No change to .config
#

...$ ARCH=sandbox make
  CHK     include/generated/version.h
  CHK     include/generated/utsrelease.h
  CREATE  include/config.h
  HOSTCC  scripts/bareboximd
In file included from /usr/include/fcntl.h:290:0,
                 from scripts/bareboximd.c:24:
In function ‘open’,
    inlined from ‘write_file’ at scripts/bareboximd.c:62:5,
    inlined from ‘imd_write_crc32’ at scripts/../common/imd.c:380:4,
    inlined from ‘imd_command’ at scripts/../common/imd.c:487:3:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to
‘__open_missing_mode’ declared with attribute error: open with O_CREAT
or O_TMPFILE in second argument needs 3 arguments
    __open_missing_mode ();
    ^~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.host:91: recipe for target 'scripts/bareboximd' failed
make[1]: *** [scripts/bareboximd] Error 1
Makefile:436: recipe for target 'scripts' failed
make: *** [scripts] Error 2

...$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.5.0-3ubuntu1~18.04'
--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++
--prefix=/usr --with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib
--enable-objc-gc=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

Franck

> Sascha
>
> >
> > Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
> > ---
> >  scripts/bareboximd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c
> > index e5000e0ae..b332d435a 100644
> > --- a/scripts/bareboximd.c
> > +++ b/scripts/bareboximd.c
> > @@ -59,7 +59,7 @@ static int write_file(const char *filename, const void *buf, size_t size)
> >       int fd, ret;
> >       int now;
> >
> > -     fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT);
> > +     fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
> >       if (fd < 0)
> >               return fd;
> >
> > --
> > 2.17.1
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-03-11 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 10:43 [PATCH] scripts/bareboximd: add mode argument to open call franck.jullien
2020-03-11 15:09 ` Sascha Hauer
2020-03-11 19:42   ` Franck Jullien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox