Skip to content

[lldb][POSIX] Replace bzero with memset in domain socket code #121747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

DhruvSrivastavaX
Copy link
Contributor

Replaced bzero with the standard memset so that it is common to all platforms.

Review Request: @DavidSpickett

@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2025

@llvm/pr-subscribers-lldb

Author: Dhruv Srivastava (DhruvSrivastavaX)

Changes

Replaced bzero with the standard memset so that it is common to all platforms.

Review Request: @DavidSpickett


Full diff: https://github.com/llvm/llvm-project/pull/121747.diff

1 Files Affected:

  • (modified) lldb/source/Host/posix/DomainSocket.cpp (+1-1)
diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp
index f85e1b9bbdc5c0..be8fcdf2c8f2c8 100644
--- a/lldb/source/Host/posix/DomainSocket.cpp
+++ b/lldb/source/Host/posix/DomainSocket.cpp
@@ -182,7 +182,7 @@ std::vector<std::string> DomainSocket::GetListeningConnectionURI() const {
     return {};
 
   struct sockaddr_un addr;
-  bzero(&addr, sizeof(struct sockaddr_un));
+  memset(&addr, 0, sizeof(struct sockaddr_un));
   addr.sun_family = AF_UNIX;
   socklen_t addr_len = sizeof(struct sockaddr_un);
   if (::getsockname(m_socket, (struct sockaddr *)&addr, &addr_len) != 0)

@DhruvSrivastavaX
Copy link
Contributor Author

Reference Discussion: #120979 (comment)

Please see if this is okay @DavidSpickett

@DavidSpickett DavidSpickett changed the title [lldb][POSIX] Replaced bzero with memset [lldb][POSIX] Replace bzero with memset in domain socket code Jan 6, 2025
Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

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

LGTM.

@DavidSpickett DavidSpickett merged commit 3bd494d into llvm:main Jan 6, 2025
9 checks passed
@DavidSpickett
Copy link
Collaborator

Thanks!

@DhruvSrivastavaX DhruvSrivastavaX deleted the bzero-memset branch January 6, 2025 11:28
paulhuggett pushed a commit to paulhuggett/llvm-project that referenced this pull request Jan 7, 2025
…21747)

Replace `bzero` with the standard `memset` so that it is common to all platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants