[Toybox] [PATCH] vi: don't call open() with O_CREAT but no mode.

enh enh at google.com
Tue Jan 31 08:28:52 PST 2023


This was invisible before because we were calling xopen(), which
always passes mode 0 to open(). Now we're calling open() directly,
bionic's _FORTIFY_SOURCE spots this.

Rather than create with 0600 and then chmod() later as the code
used to do, move the stat() before the creation so we can supply
the final permissions from the beginning.

Also rewrite the default permissions in octal, in keeping with
toybox style.
---
 toys/pending/vi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230131/145473e6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-vi-don-t-call-open-with-O_CREAT-but-no-mode.patch
Type: application/octet-stream
Size: 1589 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230131/145473e6/attachment.obj>


More information about the Toybox mailing list