Skip to content

Commit

Permalink
Fix: use uninitialized LibC::SigsetT (#15144)
Browse files Browse the repository at this point in the history
`LibC::SigsetT` is a `struct` on some platforms and an alias to `UInt32` on others. `.new` is only valid for the struct variant. `uninitialized` should work in either case.

This code is only used with `-Dgc_none`, so a reproduction needs to include that flag and build for a target where `LibC::SigsetT = alias UInt32`, such as `aarch64-apple-darwin`.
  • Loading branch information
straight-shoota authored Nov 4, 2024
1 parent 2eb1b5f commit 563d6d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/crystal/system/unix/pthread.cr
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module Crystal::System::Thread
Thread.current_thread.@suspended.set(true)

# block all signals but SIG_RESUME
mask = LibC::SigsetT.new
mask = uninitialized LibC::SigsetT
LibC.sigfillset(pointerof(mask))
LibC.sigdelset(pointerof(mask), SIG_RESUME)

Expand Down

0 comments on commit 563d6d2

Please sign in to comment.