author | zecke <zecke> | 2005-03-02 19:42:04 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-03-02 19:42:04 (UTC) |
commit | a349b5d092c392aba28c6fbd99221559c33bc5e1 (patch) (side-by-side diff) | |
tree | 56a809f42d20c6f2fe7a60f243dd1aebca359b39 | |
parent | 9f3e0913c7b01c1e14f907e756999b9d9bf9ceef (diff) | |
download | opie-a349b5d092c392aba28c6fbd99221559c33bc5e1.zip opie-a349b5d092c392aba28c6fbd99221559c33bc5e1.tar.gz opie-a349b5d092c392aba28c6fbd99221559c33bc5e1.tar.bz2 |
Close the Filedescriptor for the QCopBridge and Transferserver on exit
-rw-r--r-- | core/launcher/qcopbridge.cpp | 4 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index e339dc7..64eb096 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp @@ -24,66 +24,68 @@ /* OPIE */ #include <opie2/odebug.h> #include <opie2/oglobal.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/qpeapplication.h> #include <qtopia/version.h> using namespace Opie::Core; /* QT */ #include <qtextstream.h> #include <qtimer.h> #ifdef Q_WS_QWS #include <qcopchannel_qws.h> #endif /* STD */ #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE #endif #ifndef Q_OS_WIN32 #include <pwd.h> #include <unistd.h> +#include <fcntl.h> #include <sys/types.h> #endif #if defined(_OS_LINUX_) #include <shadow.h> #endif const int block_size = 51200; QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, const char* name ) : QServerSocket( port, 1, parent, name ), desktopChannel( 0 ), cardChannel( 0 ) { if ( !ok() ) - owarn << "Failed to bind to port " << port << "" << oendl; + owarn << "Failed to bind to port " << port << "" << oendl; else { + ::fcntl( socket(), F_SETFD, FD_CLOEXEC ); #ifndef QT_NO_COP desktopChannel = new QCopChannel( "QPE/Desktop", this ); connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); cardChannel = new QCopChannel( "QPE/Card", this ); connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); #endif } sendSync = FALSE; openConnections.setAutoDelete( TRUE ); authorizeConnections(); } QCopBridge::~QCopBridge() { #ifndef QT_NO_COP delete desktopChannel; #endif } void QCopBridge::authorizeConnections() { Config cfg("Security"); diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index 2b2e435..a219c0f 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -18,65 +18,68 @@ ** **********************************************************************/ #include "transferserver.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/oglobal.h> #include <qtopia/qprocess.h> #include <qtopia/process.h> #include <qtopia/private/contact.h> #include <qtopia/version.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif using namespace Opie::Core; /* QT */ #include <qtextstream.h> #include <qmessagebox.h> /* STD */ #include <pwd.h> #include <sys/types.h> #include <unistd.h> +#include <fcntl.h> #include <stdlib.h> #include <time.h> #ifndef Q_OS_MACX #include <shadow.h> #include <crypt.h> #endif /* Q_OS_MACX */ const int block_size = 51200; TransferServer::TransferServer( Q_UINT16 port, QObject *parent, const char* name) : QServerSocket( port, 1, parent, name ) { connections.setAutoDelete( TRUE ); if ( !ok() ) - owarn << "Failed to bind to port " << port << "" << oendl; + owarn << "Failed to bind to port " << port << "" << oendl; + else + ::fcntl( socket(), F_SETFD, FD_CLOEXEC ); } void TransferServer::authorizeConnections() { QListIterator<ServerPI> it(connections); while ( it.current() ) { if ( !it.current()->verifyAuthorised() ) { disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) ); connections.removeRef( it.current() ); } else ++it; } } void TransferServer::closed(ServerPI *item) { connections.removeRef(item); } TransferServer::~TransferServer() { } void TransferServer::newConnection( int socket ) |