Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 24d33f4..128877a 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -204,25 +204,26 @@ void ConnectWidget::init() { | |||
204 | QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname()); | 204 | QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname()); |
205 | setCaption(tit); | 205 | setCaption(tit); |
206 | 206 | ||
207 | qApp->processEvents(); | 207 | qApp->processEvents(); |
208 | 208 | ||
209 | // run the "before-connect" command | 209 | // run the "before-connect" command |
210 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { | 210 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { |
211 | messg->setText(QObject::tr("Running pre-startup command...")); | 211 | messg->setText(QObject::tr("Running pre-startup command...")); |
212 | emit debugMessage(QObject::tr("Running pre-startup command...")); | 212 | emit debugMessage(QObject::tr("Running pre-startup command...")); |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | QApplication::flushX(); | 215 | QApplication::flushX(); |
216 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); | 216 | (void)execute_command(_ifaceppp->data()->command_before_connect()); |
217 | |||
217 | // int i, status; | 218 | // int i, status; |
218 | 219 | ||
219 | // do { | 220 | // do { |
220 | // qApp->processEvents(); | 221 | // qApp->processEvents(); |
221 | // i = waitpid(id, &status, WNOHANG); | 222 | // i = waitpid(id, &status, WNOHANG); |
222 | // usleep(100000); | 223 | // usleep(100000); |
223 | // } while (i == 0 && errno == 0); | 224 | // } while (i == 0 && errno == 0); |
224 | } | 225 | } |
225 | 226 | ||
226 | int lock = _ifaceppp->modem()->lockdevice(); | 227 | int lock = _ifaceppp->modem()->lockdevice(); |
227 | 228 | ||
228 | if (lock == 1) { | 229 | if (lock == 1) { |
@@ -464,25 +465,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
464 | 465 | ||
465 | // execute the script | 466 | // execute the script |
466 | if(vmain == 2) { | 467 | if(vmain == 2) { |
467 | if(!expecting && !pausing && !scanning) { | 468 | if(!expecting && !pausing && !scanning) { |
468 | 469 | ||
469 | timeout_timer->stop(); | 470 | timeout_timer->stop(); |
470 | timeout_timer->start(scriptTimeout); | 471 | timeout_timer->start(scriptTimeout); |
471 | 472 | ||
472 | if((unsigned) scriptindex < comlist->count()) { | 473 | if((unsigned) scriptindex < comlist->count()) { |
473 | scriptCommand = *(comlist->at(scriptindex)); | 474 | scriptCommand = *(comlist->at(scriptindex)); |
474 | scriptArgument = *(arglist->at(scriptindex)); | 475 | scriptArgument = *(arglist->at(scriptindex)); |
475 | } else { | 476 | } else { |
476 | odebug << "End of script" << oendl; | 477 | odebug << "End of script" << oendl; |
477 | vmain = 10; | 478 | vmain = 10; |
478 | return; | 479 | return; |
479 | } | 480 | } |
480 | 481 | ||
481 | if (scriptCommand == "Scan") { | 482 | if (scriptCommand == "Scan") { |
482 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); | 483 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); |
483 | messg->setText(bm); | 484 | messg->setText(bm); |
484 | emit debugMessage(bm); | 485 | emit debugMessage(bm); |
485 | 486 | ||
486 | setScan(scriptArgument); | 487 | setScan(scriptArgument); |
487 | scriptindex++; | 488 | scriptindex++; |
488 | return; | 489 | return; |
@@ -830,35 +831,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
830 | 831 | ||
831 | // Close the tty. This prevents the QTimer::singleShot() in | 832 | // Close the tty. This prevents the QTimer::singleShot() in |
832 | // Modem::readtty() from re-enabling the socket notifier. | 833 | // Modem::readtty() from re-enabling the socket notifier. |
833 | // The port is still held open by the helper process. | 834 | // The port is still held open by the helper process. |
834 | 835 | ||
835 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), | 836 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), |
836 | and closing the thing prevents pppd from using it later. */ | 837 | and closing the thing prevents pppd from using it later. */ |
837 | //_ifaceppp->modem()->closetty(); | 838 | //_ifaceppp->modem()->closetty(); |
838 | 839 | ||
839 | killTimer( main_timer_ID ); | 840 | killTimer( main_timer_ID ); |
840 | 841 | ||
841 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); | 842 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); |
842 | odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; | 843 | odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; |
843 | 844 | ||
844 | // find out PPP interface and notify the stats module | 845 | // find out PPP interface and notify the stats module |
845 | // stats->setUnit(pppInterfaceNumber()); | 846 | // stats->setUnit(pppInterfaceNumber()); |
846 | 847 | ||
847 | qApp->flushX(); | 848 | qApp->flushX(); |
848 | semaphore = true; | 849 | semaphore = true; |
849 | result = execppp(); | 850 | result = execppp(); |
850 | 851 | ||
851 | emit debugMessage(QObject::tr("Starting pppd...")); | 852 | emit debugMessage(QObject::tr("Starting pppd...")); |
852 | odebug << "execppp() returned with return-code " << result << "" << oendl; | 853 | odebug << "execppp() returned with return-code " << result << "" << oendl; |
853 | 854 | ||
854 | if(result) { | 855 | if(result) { |
855 | if(!_ifaceppp->data()->autoDNS()) | 856 | if(!_ifaceppp->data()->autoDNS()) |
856 | adddns( _ifaceppp ); | 857 | adddns( _ifaceppp ); |
857 | 858 | ||
858 | // O.K we are done here, let's change over to the if_waiting loop | 859 | // O.K we are done here, let's change over to the if_waiting loop |
859 | // where we wait for the ppp if (interface) to come up. | 860 | // where we wait for the ppp if (interface) to come up. |
860 | 861 | ||
861 | emit if_waiting_signal(); | 862 | emit if_waiting_signal(); |
862 | } else { | 863 | } else { |
863 | 864 | ||
864 | // starting pppd wasn't successful. Error messages were | 865 | // starting pppd wasn't successful. Error messages were |
@@ -1056,25 +1057,25 @@ void ConnectWidget::setExpect(const QString &n) { | |||
1056 | QString ts = QObject::tr("Expecting: %1").arg(n); | 1057 | QString ts = QObject::tr("Expecting: %1").arg(n); |
1057 | ts.replace(QRegExp("\n"), "<LF>"); | 1058 | ts.replace(QRegExp("\n"), "<LF>"); |
1058 | emit debugMessage(ts); | 1059 | emit debugMessage(ts); |
1059 | 1060 | ||
1060 | // check if the expected string is in the read buffer already. | 1061 | // check if the expected string is in the read buffer already. |
1061 | checkBuffers(); | 1062 | checkBuffers(); |
1062 | } | 1063 | } |
1063 | 1064 | ||
1064 | 1065 | ||
1065 | void ConnectWidget::if_waiting_timed_out() { | 1066 | void ConnectWidget::if_waiting_timed_out() { |
1066 | if_timer->stop(); | 1067 | if_timer->stop(); |
1067 | if_timeout_timer->stop(); | 1068 | if_timeout_timer->stop(); |
1068 | odebug << "if_waiting_timed_out()" << oendl; | 1069 | odebug << "if_waiting_timed_out()" << oendl; |
1069 | 1070 | ||
1070 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); | 1071 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); |
1071 | 1072 | ||
1072 | // let's kill the stuck pppd | 1073 | // let's kill the stuck pppd |
1073 | _ifaceppp->modem()->killPPPDaemon(); | 1074 | _ifaceppp->modem()->killPPPDaemon(); |
1074 | 1075 | ||
1075 | emit stopAccounting(); | 1076 | emit stopAccounting(); |
1076 | // p_kppp->con_win->stopClock(); | 1077 | // p_kppp->con_win->stopClock(); |
1077 | 1078 | ||
1078 | 1079 | ||
1079 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() | 1080 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() |
1080 | // in main.cpp what happens next will depend on the boolean | 1081 | // in main.cpp what happens next will depend on the boolean |
@@ -1263,25 +1264,25 @@ bool ConnectWidget::execppp() { | |||
1263 | 1264 | ||
1264 | command += " call opie-kppp logfd 11"; | 1265 | command += " call opie-kppp logfd 11"; |
1265 | 1266 | ||
1266 | if (command.length() > MAX_CMDLEN) { | 1267 | if (command.length() > MAX_CMDLEN) { |
1267 | QMessageBox::critical(this, "error", QObject::tr( | 1268 | QMessageBox::critical(this, "error", QObject::tr( |
1268 | "pppd command + command-line arguments exceed " | 1269 | "pppd command + command-line arguments exceed " |
1269 | "2024 characters in length." | 1270 | "2024 characters in length." |
1270 | )); | 1271 | )); |
1271 | 1272 | ||
1272 | return false; // nonsensically long command which would bust my buffer buf. | 1273 | return false; // nonsensically long command which would bust my buffer buf. |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | owarn << "Command IS: " << command.latin1() << "" << oendl; | 1276 | owarn << "Command IS: " << command.latin1() << "" << oendl; |
1276 | 1277 | ||
1277 | qApp->flushX(); | 1278 | qApp->flushX(); |
1278 | 1279 | ||
1279 | return _ifaceppp->modem()->execPPPDaemon(command); | 1280 | return _ifaceppp->modem()->execPPPDaemon(command); |
1280 | } | 1281 | } |
1281 | 1282 | ||
1282 | 1283 | ||
1283 | void ConnectWidget::closeEvent( QCloseEvent *e ) { | 1284 | void ConnectWidget::closeEvent( QCloseEvent *e ) { |
1284 | e->ignore(); | 1285 | e->ignore(); |
1285 | emit cancelbutton(); | 1286 | emit cancelbutton(); |
1286 | } | 1287 | } |
1287 | 1288 | ||