author | spiralman <spiralman> | 2002-05-16 21:14:13 (UTC) |
---|---|---|
committer | spiralman <spiralman> | 2002-05-16 21:14:13 (UTC) |
commit | d8d70e07a09a7c50021f6c85690b79b422d43df5 (patch) (side-by-side diff) | |
tree | 56e4655aca1eac9b46f44e78e2cc378e7f7033de | |
parent | daeba256e5a7442dde237f39a6272485e01b7ccd (diff) | |
download | opie-d8d70e07a09a7c50021f6c85690b79b422d43df5.zip opie-d8d70e07a09a7c50021f6c85690b79b422d43df5.tar.gz opie-d8d70e07a09a7c50021f6c85690b79b422d43df5.tar.bz2 |
fixed segfault when socket() returns -1 (hopefully)
-rw-r--r-- | noncore/tools/remote/buttondialog.cpp | 25 | ||||
-rw-r--r-- | noncore/tools/remote/remotetab.cpp | 15 | ||||
-rw-r--r-- | noncore/tools/remote/remotetab.h | 2 |
3 files changed, 40 insertions, 2 deletions
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp index e7ff4b4..7479e85 100644 --- a/noncore/tools/remote/buttondialog.cpp +++ b/noncore/tools/remote/buttondialog.cpp @@ -99,4 +99,16 @@ QStringList ButtonDialog::getRemotes() fd = socket(AF_UNIX, SOCK_STREAM, 0); + if(fd == -1) + { + QMessageBox *mb = new QMessageBox("Error!", + "couldnt connect to socket", + QMessageBox::NoIcon, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); + mb->exec(); + perror("ButtonDialog::GetRemotes"); + return NULL; + } if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) @@ -159,4 +171,17 @@ QStringList ButtonDialog::getButtons(const char *remoteName) fd = socket(AF_UNIX, SOCK_STREAM, 0); + if(fd == -1) + { + QMessageBox *mb = new QMessageBox("Error!", + "couldnt connect to socket", + QMessageBox::NoIcon, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); + mb->exec(); + perror("ButtonDialog::GetButtons"); + return NULL; + } + if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) diff --git a/noncore/tools/remote/remotetab.cpp b/noncore/tools/remote/remotetab.cpp index f3a8945..64b8ee4 100644 --- a/noncore/tools/remote/remotetab.cpp +++ b/noncore/tools/remote/remotetab.cpp @@ -52,5 +52,5 @@ RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name) } -void RemoteTab::sendIR() +int RemoteTab::sendIR() { const QObject *button = sender(); @@ -62,4 +62,17 @@ void RemoteTab::sendIR() fd = socket(AF_UNIX, SOCK_STREAM, 0); + if(fd == -1) + { + QMessageBox *mb = new QMessageBox("Error!", + "couldnt connect to socket", + QMessageBox::NoIcon, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); + mb->exec(); + perror("RemoteTab::SendIR"); + return NULL; + } + if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) diff --git a/noncore/tools/remote/remotetab.h b/noncore/tools/remote/remotetab.h index 77a7318..38b58e9 100644 --- a/noncore/tools/remote/remotetab.h +++ b/noncore/tools/remote/remotetab.h @@ -51,5 +51,5 @@ public: void updateRemotesList(); public slots: - void sendIR(); + int sendIR(); void remoteSelected(const QString &string); private: |