swift-system icon indicating copy to clipboard operation
swift-system copied to clipboard

strerror is not (guaranteed) to be thread safe

Open semicoleon opened this issue 1 year ago • 1 comments

This package's Errno type is using strerror to produce error strings. For unknown error numbers strerror writes a string into a static buffer and returns it, but whether this static buffer is thread local is unspecified. Using strerror_r would guarantee thread safety even for unknown error codes.

semicoleon avatar Mar 13 '24 18:03 semicoleon

We might want to use strerror_s from C11 instead, for portability.

glessard avatar Mar 19 '24 23:03 glessard