mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Mauderer <christian.mauderer@embedded-brains.de>
To: barebox@lists.infradead.org
Subject: [PATCH] scripts: imd: Fix missing argument for open
Date: Mon, 11 May 2020 17:33:52 +0200	[thread overview]
Message-ID: <20200511153352.7121-1-christian.mauderer@embedded-brains.de> (raw)

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

             reply	other threads:[~2020-05-11 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 15:33 Christian Mauderer [this message]
2020-05-12  5:31 ` Ahmad Fatoum
2020-05-12  6:32   ` Christian Mauderer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511153352.7121-1-christian.mauderer@embedded-brains.de \
    --to=christian.mauderer@embedded-brains.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox