author | erik <erik> | 2007-01-31 22:06:07 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-31 22:06:07 (UTC) |
commit | 9395cf2a65184e493714c699bb23b02ea31feef5 (patch) (unidiff) | |
tree | ea07c026298820559c13ad32e612d51048cee0a9 /noncore/settings/networksettings | |
parent | 958e042c5a4d4e38fd1baae50b78a2febfd306ab (diff) | |
download | opie-9395cf2a65184e493714c699bb23b02ea31feef5.zip opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.gz opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.bz2 |
I expanded my audit to include any app I could get to compile in i386.
In that expansion a whole new crop of unchecked returns has sprung up.
This commit fixes those weeds or should I say potential bugs.
Diffstat (limited to 'noncore/settings/networksettings') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | 11 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp index 650e634..e81f603 100644 --- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | |||
@@ -193,13 +193,14 @@ void MainWindowImp::getAllInterfaces() | |||
193 | if ( !QString( pifr->ifr_name ).startsWith( "wifi" ) ) ifaces += pifr->ifr_name; | 193 | if ( !QString( pifr->ifr_name ).startsWith( "wifi" ) ) ifaces += pifr->ifr_name; |
194 | else odebug << "ignoring hostap control interface " << pifr->ifr_name << oendl; | 194 | else odebug << "ignoring hostap control interface " << pifr->ifr_name << oendl; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | else | 197 | else |
198 | { | 198 | { |
199 | procFile.open(IO_ReadOnly); | 199 | if (!procFile.open(IO_ReadOnly)) |
200 | owarn << "Failed to open proc file " << procFile.name() << oendl; | ||
200 | QString line; | 201 | QString line; |
201 | QTextStream procTs(&procFile); | 202 | QTextStream procTs(&procFile); |
202 | int loc = -1; | 203 | int loc = -1; |
203 | 204 | ||
204 | procTs.readLine(); // eat a line | 205 | procTs.readLine(); // eat a line |
205 | procTs.readLine(); // eat a line | 206 | procTs.readLine(); // eat a line |
@@ -729,13 +730,14 @@ void MainWindowImp::setHostname() | |||
729 | } | 730 | } |
730 | 731 | ||
731 | OProcess h; | 732 | OProcess h; |
732 | _procTemp=""; | 733 | _procTemp=""; |
733 | h << "hostname" << m_Nameinput->text(); | 734 | h << "hostname" << m_Nameinput->text(); |
734 | connect(&h,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int))); | 735 | connect(&h,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int))); |
735 | h.start(OProcess::Block,OProcess::Stderr); | 736 | if (!h.start(OProcess::Block,OProcess::Stderr)) |
737 | owarn << "Failed execution of 'hostname'. Are the paths correct?" << oendl; | ||
736 | odebug << "Got " << _procTemp << " - " << h.exitStatus() << oendl; | 738 | odebug << "Got " << _procTemp << " - " << h.exitStatus() << oendl; |
737 | if (h.exitStatus()!=0) { | 739 | if (h.exitStatus()!=0) { |
738 | QMessageBox::critical(0, tr("Sorry"), QString(tr("Could not set name.\n%1")).arg(_procTemp.stripWhiteSpace())); | 740 | QMessageBox::critical(0, tr("Sorry"), QString(tr("Could not set name.\n%1")).arg(_procTemp.stripWhiteSpace())); |
739 | return; | 741 | return; |
740 | } | 742 | } |
741 | _procTemp=""; | 743 | _procTemp=""; |
@@ -765,19 +767,20 @@ void MainWindowImp::initHostname() | |||
765 | { | 767 | { |
766 | OProcess h; | 768 | OProcess h; |
767 | _procTemp=""; | 769 | _procTemp=""; |
768 | 770 | ||
769 | h << "hostname"; | 771 | h << "hostname"; |
770 | connect(&h,SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int))); | 772 | connect(&h,SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int))); |
771 | h.start(OProcess::Block,OProcess::AllOutput); | 773 | if (!h.start(OProcess::Block,OProcess::AllOutput)) |
774 | owarn << "Could not execute 'hostname'. Are the paths correct?" oendl; | ||
772 | odebug << "Got " << _procTemp <<oendl; | 775 | odebug << "Got " << _procTemp <<oendl; |
773 | m_Nameinput->setText(_procTemp.stripWhiteSpace()); | 776 | m_Nameinput->setText(_procTemp.stripWhiteSpace()); |
774 | _procTemp=""; | 777 | _procTemp=""; |
775 | } | 778 | } |
776 | 779 | ||
777 | void MainWindowImp::slotHostname(Opie::Core::OProcess */*proc*/, char *buffer, int buflen) | 780 | void MainWindowImp::slotHostname(Opie::Core::OProcess * /*proc*/, char *buffer, int buflen) |
778 | { | 781 | { |
779 | if (buflen < 1 || buffer==0) return; | 782 | if (buflen < 1 || buffer==0) return; |
780 | char*_t = new char[buflen+1]; | 783 | char*_t = new char[buflen+1]; |
781 | ::memset(_t,0,buflen+1); | 784 | ::memset(_t,0,buflen+1); |
782 | ::memcpy(_t,buffer,buflen); | 785 | ::memcpy(_t,buffer,buflen); |
783 | _procTemp+=_t; | 786 | _procTemp+=_t; |
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 7b2e2a3..17ada9b 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -765,14 +765,16 @@ bool Modem::createAuthFile(Auth method, const char *username, const char *passwo | |||
765 | if(!(oldName = authFile(method, Old))) | 765 | if(!(oldName = authFile(method, Old))) |
766 | return false; | 766 | return false; |
767 | 767 | ||
768 | // delete old file if any | 768 | // delete old file if any |
769 | unlink(oldName); | 769 | unlink(oldName); |
770 | 770 | ||
771 | rename(authfile, oldName); | 771 | if (rename(authfile, oldName) == -1) |
772 | rename(newName, authfile); | 772 | return false; |
773 | if (rename(newName, authfile) == -1) | ||
774 | return false; | ||
773 | 775 | ||
774 | return true; | 776 | return true; |
775 | } | 777 | } |
776 | 778 | ||
777 | 779 | ||
778 | bool Modem::removeAuthFile(Auth method) { | 780 | bool Modem::removeAuthFile(Auth method) { |