[Openvpn-devel,2/9] Remove getpeername, getpid check
Commit Message
getpeername is part of SUSv3 and Windows also provides the function
as part of winsocks.
getpid is also provided by both Posix and windows and we do not even
use getpid on Windows since we rather call GetCurrentProcessId.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
configure.ac | 4 ++--
src/openvpn/platform.c | 4 ----
src/openvpn/socket.c | 7 -------
3 files changed, 2 insertions(+), 13 deletions(-)
Comments
Acked-by: Gert Doering <gert@greenie.muc.de>
"because it makes sense" (we discussed this on IRC, and I couldn't
find anything in my software museum that has no getpeername() - not
even SCO Unix! - and checking for getpid() borders on ridiculous...)
Stared-at-patch, test compiled on Linux.
Your patch has been applied to the master branch.
commit 84e14209232441fd6601d3efb7c7aa93bee4ce88
Author: Arne Schwabe
Date: Wed May 12 15:15:04 2021 +0200
Remove getpeername, getpid check
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210512131511.1309914-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22340.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
@@ -619,10 +619,10 @@ AC_CHECK_DECLS(
AC_FUNC_FORK
AC_CHECK_FUNCS([ \
- daemon chroot getpwnam setuid nice system getpid dup dup2 \
+ daemon chroot getpwnam setuid nice system dup dup2 \
syslog openlog mlockall getrlimit getgrnam setgid \
setgroups flock readv writev time gettimeofday \
- setsid chdir getpeername \
+ setsid chdir \
chsize ftruncate execve getpeereid basename dirname access \
epoll_create strsep \
])
@@ -184,11 +184,7 @@ platform_getpid(void)
#ifdef _WIN32
return (unsigned int) GetCurrentProcessId();
#else
-#ifdef HAVE_GETPID
return (unsigned int) getpid();
-#else
- return 0;
-#endif
#endif
}
@@ -1227,7 +1227,6 @@ socket_do_accept(socket_descriptor_t sd,
CLEAR(*act);
-#ifdef HAVE_GETPEERNAME
if (nowait)
{
new_sd = getpeername(sd, &act->dest.addr.sa, &remote_len);
@@ -1241,12 +1240,6 @@ socket_do_accept(socket_descriptor_t sd,
new_sd = sd;
}
}
-#else /* ifdef HAVE_GETPEERNAME */
- if (nowait)
- {
- msg(M_WARN, "TCP: this OS does not provide the getpeername() function");
- }
-#endif
else
{
new_sd = accept(sd, &act->dest.addr.sa, &remote_len);