[Toybox] [PATCH] timeout.c: fix for macOS.

enh enh at google.com
Wed Aug 24 17:31:13 PDT 2022


I don't know why we get away with this on Linux, but macOS really
means business with the "values of objects of automatic storage
invocation duration that do not have the volatile type and have
been changed between the setjmp() invocation and longjmp() call are
indeterminate" thing, leading to bad fds and a bad pid. Using
volatile causes lots of warnings about passing `volatile int*`
instead of `int*`, so it's a smaller change to move the fields into
TT (and avoid the "automatic storage" part) than it is to add the
`volatile` modifier.

Four timeout tests fail on macOS (both locally and on github's CI)
without this patch, and all timeout tests pass on macOS with this
patch.
---
 toys/other/timeout.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220824/1ba861b4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-timeout.c-fix-for-macOS.patch
Type: application/octet-stream
Size: 2958 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220824/1ba861b4/attachment.obj>


More information about the Toybox mailing list