Skip to content

lib: don't use strerror()#7685

Closed
bagder wants to merge 3 commits intomasterfrom
bagder/avoid-strerror
Closed

lib: don't use strerror()#7685
bagder wants to merge 3 commits intomasterfrom
bagder/avoid-strerror

Conversation

@bagder
Copy link
Member

@bagder bagder commented Sep 8, 2021

We have and provide Curl_strerror() internally for a reason: strerror()
is not necessarily thread-safe so we should always try to avoid it.

Extended checksrc to warn for this, but feature the check disabled by
default and only enable it in lib/

We have and provide Curl_strerror() internally for a reason: strerror()
is not necessarily thread-safe so we should always try to avoid it.

Extended checksrc to warn for this, but feature the check disabled by
default and only enable it in lib/
@bagder bagder added the tidy-up label Sep 8, 2021
@bagder bagder closed this in 2f0bb86 Sep 9, 2021
@bagder bagder deleted the bagder/avoid-strerror branch September 9, 2021 05:55
jay added a commit to jay/curl that referenced this pull request Sep 17, 2021
- Change Curl_strerror to use sys_errlist[errnum] instead of strerror to
  retrieve the error message on Windows.

Windows' strerror writes to a static buffer and is not thread-safe.

Follow-up to 2f0bb86 which removed most instances of strerror in favor
of calling Curl_strerror (which calls strerror_r for other platforms).

Ref: curl#7685
Ref: curl@2f0bb86

Closes #xxxx
jay added a commit that referenced this pull request Sep 17, 2021
- Change Curl_strerror to use sys_errlist[errnum] instead of strerror to
  retrieve the error message on Windows.

Windows' strerror writes to a static buffer and is not thread-safe.

Follow-up to 2f0bb86 which removed most instances of strerror in favor
of calling Curl_strerror (which calls strerror_r for other platforms).

Ref: #7685
Ref: 2f0bb86

Closes #7735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant