pw_data_link: Fix macOS build
Change-Id: Ia63667cbccabeacb1260e110aa86f4ccd9fb86b8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/experimental/+/178116
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Chinchilla <cachinchilla@google.com>
diff --git a/pw_data_link/socket_data_link.cc b/pw_data_link/socket_data_link.cc
index 0189ff7..ca0b593 100644
--- a/pw_data_link/socket_data_link.cc
+++ b/pw_data_link/socket_data_link.cc
@@ -180,7 +180,8 @@
// Use SO_NOSIGPIPE to avoid getting a SIGPIPE signal when the remote peer
// drops the connection. This is supported on macOS only.
constexpr int value = 1;
- if (setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(int)) < 0) {
+ if (setsockopt(
+ connection_fd_, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(int)) < 0) {
PW_LOG_WARN("Failed to set SO_NOSIGPIPE: %s", std::strerror(errno));
}
#endif // defined(__APPLE__)