mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: imd: Fix missing argument for open
@ 2020-05-11 15:33 Christian Mauderer
  2020-05-12  5:31 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Mauderer @ 2020-05-11 15:33 UTC (permalink / raw)
  To: barebox

According to POSIX open needs a third argument if O_CREAT is specified:

>  O_CREAT  If  the  file exists, this flag has no effect.
>           Otherwise, the file shall be created; [...] and the access
>           permission bits (see <sys/stat.h>) of the file  mode shall
>           be set to the value of the argument following the oflag
>           argument taken as type mode_t modified as follows [...]

Signed-off-by: Christian Mauderer <christian.mauderer@embedded-brains.de>
---
 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.26.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: imd: Fix missing argument for open
  2020-05-11 15:33 [PATCH] scripts: imd: Fix missing argument for open Christian Mauderer
@ 2020-05-12  5:31 ` Ahmad Fatoum
  2020-05-12  6:32   ` Christian Mauderer
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2020-05-12  5:31 UTC (permalink / raw)
  To: Christian Mauderer, barebox

Hello Christian,

On 5/11/20 5:33 PM, Christian Mauderer wrote:
> According to POSIX open needs a third argument if O_CREAT is specified:
> 
>>  O_CREAT  If  the  file exists, this flag has no effect.
>>           Otherwise, the file shall be created; [...] and the access
>>           permission bits (see <sys/stat.h>) of the file  mode shall
>>           be set to the value of the argument following the oflag
>>           argument taken as type mode_t modified as follows [...]

Thanks for the patch. The issue has been already addressed though
by 6f0e2f65b3 ("scripts/bareboximd: add mode argument to open call"),
which is part of v2020.04.0.

Cheers
Ahmad

> 
> Signed-off-by: Christian Mauderer <christian.mauderer@embedded-brains.de>
> ---
>  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;
>  
> 

-- 
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: imd: Fix missing argument for open
  2020-05-12  5:31 ` Ahmad Fatoum
@ 2020-05-12  6:32   ` Christian Mauderer
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Mauderer @ 2020-05-12  6:32 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox

Hello Ahmad,

On 12/05/2020 07:31, Ahmad Fatoum wrote:
> Hello Christian,
> 
> On 5/11/20 5:33 PM, Christian Mauderer wrote:
>> According to POSIX open needs a third argument if O_CREAT is specified:
>>
>>>  O_CREAT  If  the  file exists, this flag has no effect.
>>>           Otherwise, the file shall be created; [...] and the access
>>>           permission bits (see <sys/stat.h>) of the file  mode shall
>>>           be set to the value of the argument following the oflag
>>>           argument taken as type mode_t modified as follows [...]
> 
> Thanks for the patch. The issue has been already addressed though
> by 6f0e2f65b3 ("scripts/bareboximd: add mode argument to open call"),
> which is part of v2020.04.0.

I had problems building v2020.03.0 and missed to update from upstream
before checking whether there is a patch on master. Sorry for the noise.

Best regards

Christian

> 
> Cheers
> Ahmad
> 
>>
>> Signed-off-by: Christian Mauderer <christian.mauderer@embedded-brains.de>
>> ---
>>  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;
>>  
>>
> 

-- 
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

_______________________________________________
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-05-12  6:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 15:33 [PATCH] scripts: imd: Fix missing argument for open Christian Mauderer
2020-05-12  5:31 ` Ahmad Fatoum
2020-05-12  6:32   ` Christian Mauderer

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