Applied Debian patch to fix busy loop when run from inetd in nowait mode (bug #920373).

This commit is contained in:
Tim Waugh 2013-05-23 12:25:58 +01:00
parent a493fdedea
commit 7eaa10a1fc
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,53 @@
diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx
--- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait 2013-05-23 12:20:35.836386218 +0100
+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx 2013-05-23 12:23:04.698003213 +0100
@@ -325,18 +325,12 @@ bool TcpSocket::cork(int sock, bool enab
#endif
}
-bool TcpSocket::isSocket(int sock)
+bool TcpSocket::isListening(int sock)
{
- struct sockaddr_in info;
- socklen_t info_size = sizeof(info);
- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0;
-}
-
-bool TcpSocket::isConnected(int sock)
-{
- struct sockaddr_in info;
- socklen_t info_size = sizeof(info);
- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0;
+ int listening = 0;
+ socklen_t listening_size = sizeof(listening);
+ return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening,
+ &listening_size) >= 0 && listening;
}
int TcpSocket::getSockPort(int sock)
diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h
--- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait 2013-05-23 12:20:35.835386220 +0100
+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h 2013-05-23 12:21:58.861730647 +0100
@@ -57,8 +57,7 @@ namespace network {
static bool enableNagles(int sock, bool enable);
static bool cork(int sock, bool enable);
- static bool isSocket(int sock);
- static bool isConnected(int sock);
+ static bool isListening(int sock);
static int getSockPort(int sock);
private:
bool closeFd;
diff -up tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc
--- tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait 2013-03-14 17:11:22.000000000 +0000
+++ tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc 2013-05-23 12:21:10.545530308 +0100
@@ -225,8 +225,7 @@ void vncExtensionInit()
network::TcpListener* listener = 0;
network::TcpListener* httpListener = 0;
if (scr == 0 && vncInetdSock != -1) {
- if (network::TcpSocket::isSocket(vncInetdSock) &&
- !network::TcpSocket::isConnected(vncInetdSock))
+ if (network::TcpSocket::isListening(vncInetdSock))
{
listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true);
vlog.info("inetd wait");

View File

@ -44,6 +44,7 @@ Patch10: tigervnc11-ldnow.patch
Patch11: tigervnc11-gethomedir.patch
Patch13: tigervnc11-rh692048.patch
Patch14: tigervnc12-xorg113-glx.patch
Patch15: tigervnc-inetd-nowait.patch
%description
Virtual Network Computing (VNC) is a remote display system which
@ -149,6 +150,10 @@ popd
%patch14 -p1 -b .glx
# Applied Debian patch to fix busy loop when run from inetd in nowait
# mode (bug #920373).
%patch15 -p1 -b .inetd-nowait
%build
%ifarch sparcv9 sparc64 s390 s390x
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
@ -310,7 +315,9 @@ fi
%{_datadir}/icons/hicolor/*/apps/*
%changelog
* Wed May 22 2013 Tim Waugh <twaugh@redhat.com> 1.2.80-0.14.20130314svn5065
* Thu May 23 2013 Tim Waugh <twaugh@redhat.com> 1.2.80-0.14.20130314svn5065
- Applied Debian patch to fix busy loop when run from inetd in nowait
mode (bug #920373).
- Added dependency on xorg-x11-xinit to server sub-package so that
default window manager can be found (bug #896284, bug #923655).
- Fixed bogus changelog date.