[Toybox] [PATCH] macOS: replace local strnstr with strcasestr.
enh
enh at google.com
Mon Dec 3 08:27:20 PST 2018
On Sun, Dec 2, 2018 at 2:57 PM Rob Landley <rob at landley.net> wrote:
>
> On 12/1/18 12:48 AM, enh wrote:
> >> /opt/android/x86_64/bin/../sysroot/usr/include/stdlib.h:68:47: note: 'mktemp'
> >> has been explicitly marked deprecated here
> >> char* mktemp(char* __template) __attribute__((deprecated("mktemp is unsa...
> >> ^
> >> 1 warning generated.
> >>
> >> Why is it unsafe? (musl and glibc don't complain...)
> >
> > dunno about musl, but glibc does (just at link time rather than
> > compile time --- iirc we no longer have any link-time warnings in
> > bionic, just compile time ones).
>
> Um, _you_ added this warning in commit 40a09367f6f9.
yes, i know. mktemp(3) is the correct implementation of mktemp(1) -u.
the old implementation (which actually created a file) is observably
different, subject to the exact same race anyway, and doesn't work if
you can't write to the directory (and if that's what someone was
trying to do, they wouldn't^Wshouldn't be using -u in the first
place).
like i said, this is one of the reasons why bionic doesn't use
link-time warnings: there's no targeted way to say "this specific case
is fine" like you can with a compiler warning, it's all or nothing.
> - if (d_flag ? !mkdtemp(template) : mkstemp(template) == -1) {
> + if (toys.optflags & FLAG_u) {
> + mktemp(template);
>
> Why did you do that? (What's the issue you were trying to solve, exactly?)
>
> Rob
More information about the Toybox
mailing list