]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Remove getpeername, getpid check
authorArne Schwabe <arne@rfc2549.org>
Wed, 12 May 2021 13:15:04 +0000 (15:15 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 14 May 2021 12:02:25 +0000 (14:02 +0200)
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>
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>
configure.ac
src/openvpn/platform.c
src/openvpn/socket.c

index dce7982cc534049a904d4556097b210f098e7285..cc1dedbb93593e6e2338cc24fb16e801a456300d 100644 (file)
@@ -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 \
 ])
index bf7b1aa0a21ab86baf6773f2cc4d5ac134cf011c..831cc46b19a91f2df5fce544eb43680ed31e11b1 100644 (file)
@@ -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
 }
 
index 407e411c0b2c602ba0c66d673050e5f3bbd79f04..02a6a7db4aa62bd63afdb65dac3c56da1dc02b68 100644 (file)
@@ -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);