Skip to content

smb: do not redefine getpid on Windows - #15263

Closed
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:w-smb-getpid-tidy
Closed

smb: do not redefine getpid on Windows#15263
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:w-smb-getpid-tidy

Conversation

@vszakats

@vszakats vszakats commented Oct 11, 2024

Copy link
Copy Markdown
Member

Replace with namespaced local macro Curl_getpid().

Redefining symbols can backfire if that symbol is used in system
headers, especially with unity build. We haven't seen a fallout in CI
or supported envs, but do it anyway for good measure.

Bug report: https://datagirl.xyz/posts/wolfssl_curl_w2k.html

Make an `#if` branch instead for the single place it was used.

Redefining symbols can backfire if that symbol is used in system
headers, especially in unity build. We haven't seen a fallout in
CI or supported envs, but do it anyway for good measure.

Bug report: https://datagirl.xyz/posts/wolfssl_curl_w2k.html
@vszakats vszakats added Windows Windows-specific tidy-up SMB labels Oct 11, 2024

@bagder bagder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I find code easier to read and work with without #ifdefs in the midst of it, hence it is better to define a macro and use that rather than this approach.

Perhaps Curl_getpid() ?

@vszakats

Copy link
Copy Markdown
Member Author

In general I find code easier to read and work with without #ifdefs in the midst of it, hence it is better to define a macro and use that rather than this approach.

Perhaps Curl_getpid() ?

Yes, that can work. I skipped it initially for simplicity but this is perhaps more future proof indeed.

Also moved the cast inside the macro, do you think it's OK?

@vszakats vszakats closed this in 960521d Oct 13, 2024
@vszakats
vszakats deleted the w-smb-getpid-tidy branch October 13, 2024 16:02
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Replace with namespaced local macro `Curl_getpid()`.

Redefining symbols can backfire if that symbol is used in system
headers, especially with unity build. We haven't seen a fallout in CI
or supported envs, but do it anyway for good measure.

Bug report: https://datagirl.xyz/posts/wolfssl_curl_w2k.html
Closes curl#15263
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.

2 participants