nandtool: Add missing mode for open() with O_CREAT

If O_CREAT is given, open() needs a mode argument. Follow the umask by
passing 0666.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13607
This commit is contained in:
Jilles Tjoelker 2017-12-26 16:20:38 +00:00
parent ce3eafc4a5
commit 2fe0ea7324
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327211
2 changed files with 2 additions and 2 deletions

View file

@ -52,7 +52,7 @@ int nand_read(struct cmd_param *params)
}
if ((out = param_get_string(params, "out"))) {
out_fd = open(out, O_WRONLY|O_CREAT);
out_fd = open(out, O_WRONLY|O_CREAT, 0666);
if (out_fd == -1) {
perrorf("Cannot open %s for writing", out);
return (1);

View file

@ -59,7 +59,7 @@ int nand_read_oob(struct cmd_param *params)
}
if ((out = param_get_string(params, "out"))) {
if ((fd_out = open(out, O_WRONLY | O_CREAT)) == -1) {
if ((fd_out = open(out, O_WRONLY | O_CREAT, 0666)) == -1) {
perrorf("Cannot open %s", out);
ret = 1;
goto out;