summaryrefslogtreecommitdiff
authorerik <erik>2007-01-19 01:18:01 (UTC)
committer erik <erik>2007-01-19 01:18:01 (UTC)
commit32343107b30904806d02672955c57ed53d39fe79 (patch) (side-by-side diff)
tree9114a0ea170e3adc807a2445b49360f1bfde9626
parentac0ce844e90a64247c0adb210e0a23021b011d57 (diff)
downloadopie-32343107b30904806d02672955c57ed53d39fe79.zip
opie-32343107b30904806d02672955c57ed53d39fe79.tar.gz
opie-32343107b30904806d02672955c57ed53d39fe79.tar.bz2
Every file in this commit has a change to check the return value of a call.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp33
-rw-r--r--core/launcher/qprocess_unix.cpp6
-rw-r--r--core/launcher/server.cpp19
-rw-r--r--core/settings/launcher/menusettings.cpp5
-rw-r--r--core/settings/launcher/taskbarsettings.cpp13
-rw-r--r--libopie2/opiecore/oglobal.cpp2
-rw-r--r--libopie2/opiecore/oprocess.cpp2
-rw-r--r--library/global.cpp63
-rw-r--r--noncore/apps/advancedfm/output.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp5
-rw-r--r--noncore/settings/usermanager/userdialog.cpp9
11 files changed, 94 insertions, 68 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 759e440..61beac5 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -663,20 +663,21 @@ void TextEdit::newFile( const DocLnk &f ) {
void TextEdit::openDotFile( const QString &f ) {
if(!currentFileName.isEmpty()) {
- currentFileName=f;
-
- odebug << "openFile dotfile " + currentFileName << oendl;
- QString txt;
- QFile file(f);
- file.open(IO_ReadWrite);
- QTextStream t(&file);
- while ( !t.atEnd()) {
- txt+=t.readLine()+"\n";
- }
- editor->setText(txt);
- editor->setEdited( false);
- edited1=false;
- edited=false;
-
-
+ currentFileName=f;
+
+ odebug << "openFile dotfile " + currentFileName << oendl;
+ QString txt;
+ QFile file(f);
+ if (!file.open(IO_ReadWrite))
+ owarn << "Failed to open file " << file.name() << oendl;
+ else {
+ QTextStream t(&file);
+ while ( !t.atEnd()) {
+ txt+=t.readLine()+"\n";
+ }
+ editor->setText(txt);
+ editor->setEdited( false);
+ edited1=false;
+ edited=false;
+ }
}
updateCaption( currentFileName);
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp
index 97c0460..3125bcc 100644
--- a/core/launcher/qprocess_unix.cpp
+++ b/core/launcher/qprocess_unix.cpp
@@ -314,5 +314,9 @@ void QProcessManager::sigchldHnd( int fd )
{
char tmp;
- ::read( fd, &tmp, sizeof(tmp) );
+ if (::read( fd, &tmp, sizeof(tmp) ) < 0)
+#if defined(QT_QPROCESS_DEBUG)
+ odebug << "QProcessManager::sigchldHnd() failed dummy read of file descriptor" << oendl;
+#endif
+ ;
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd()" << oendl;
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 921b790..c45265a 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -368,14 +368,22 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
QString baseFile, deltaFile;
stream >> baseFile >> deltaFile;
+ bool fileWasCreated = false;
if ( !QFile::exists( baseFile ) ) {
QFile f( baseFile );
- f.open( IO_WriteOnly );
+ fileWasCreated = f.open( IO_WriteOnly );
f.close();
}
- QRsync::applyDiff( baseFile, deltaFile );
+ if ( fileWasCreated ) {
+ QRsync::applyDiff( baseFile, deltaFile );
#ifndef QT_NO_COP
- QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
- e << baseFile;
+ QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
+ e << baseFile;
#endif
+ } else {
+#ifndef QT_NO_COP
+ QCopEnvelope e( "QPE/Desktop", "patchUnapplied(QString)" );
+ e << baseFile;
+#endif
+ }
} else if ( msg == "rdiffCleanup()" ) {
mkdir( "/tmp/rdiff" );
@@ -999,5 +1007,6 @@ void Server::startSoundServer() {
process->clearArguments();
*process << QPEApplication::qpeDir() + "bin/qss";
- process->start();
+ if (!process->start())
+ owarn << "Sound server process did not start" << oendl;
}
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 29ce841..d63b203 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -34,4 +34,5 @@ _;:, .> :=|. This file is free software; you can
#include <qpe/menuappletinterface.h>
#include <qpe/qcopenvelope_qws.h>
+#include <opie2/odebug.h>
#include <qdir.h>
@@ -95,5 +96,7 @@ void MenuSettings::init ( )
QLibrary *lib = new QLibrary ( path + "/" + *it );
- lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
+ QRESULT retVal = QS_OK;
+ if ((retVal = lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**)(&iface) )) != QS_OK )
+ owarn << "queryInterface failed with " << retVal << oendl;
if ( iface ) {
QString lang = getenv( "LANG" );
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 861ff3a..c2b82b9 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -92,5 +92,7 @@ void TaskbarSettings::init ( )
owarn << "Load applet: " << (*it) << "" << oendl;
QLibrary *lib = new QLibrary ( path + "/" + *it );
- lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
+ QRESULT retVal = QS_OK;
+ if ((retVal = lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**)(&iface) )) != QS_OK)
+ owarn << "<0>" << oendl;
owarn << "<1>" << oendl;
if ( iface ) {
@@ -111,8 +113,9 @@ void TaskbarSettings::init ( )
if ( !iface ) {
owarn << "<4>" << oendl;
- lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
+ if ((retVal = lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**)(&iface))) != QS_OK)
+ owarn << "<5>" << oendl;
if ( iface ) {
- owarn << "<5>" << oendl;
+ owarn << "<6>" << oendl;
name = (*it). mid ( 3 );
owarn << "Found applet: " << name << "" << oendl;
@@ -131,8 +134,8 @@ void TaskbarSettings::init ( )
}
}
- owarn << "<6>" << oendl;
+ owarn << "<7>" << oendl;
if ( iface ) {
- owarn << "<7>" << oendl;
+ owarn << "<8>" << oendl;
QCheckListItem *item;
item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp
index 706ac6c..b7d59fc 100644
--- a/libopie2/opiecore/oglobal.cpp
+++ b/libopie2/opiecore/oglobal.cpp
@@ -345,5 +345,5 @@ bool OGlobal::isDocumentFileName( const QString& file )
return true;
}
- if (file.startsWith(homeDirPath())+"/Documents/") return true;
+ if (file.startsWith(homeDirPath()+"/Documents/")) return true;
return false;
}
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index b3f9724..56f9883 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -929,5 +929,5 @@ int OProcess::processPID( const QString& process )
//qDebug( "next entry: %s", (const char*) *it );
QFile file( "/proc/"+*it+"/cmdline" );
- file.open( IO_ReadOnly );
+ if ( !file.open( IO_ReadOnly ) ) continue;
if ( !file.isOpen() ) continue;
QTextStream t( &file );
diff --git a/library/global.cpp b/library/global.cpp
index f7a0767..7bdd0b1 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -217,37 +217,36 @@ const QDawg& Global::fixedDawg()
{
if ( !fixed_dawg ) {
- if ( !docDirCreated )
- createDocDir();
-
- fixed_dawg = new QDawg;
- QString dawgfilename = dictDir() + "/dawg";
- QString words_lang;
- QStringList langs = Global::languageList();
- for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
- QString lang = *it;
- words_lang = dictDir() + "/words." + lang;
- QString dawgfilename_lang = dawgfilename + "." + lang;
- if ( QFile::exists(dawgfilename_lang) ||
- QFile::exists(words_lang) ) {
- dawgfilename = dawgfilename_lang;
- break;
- }
- }
- QFile dawgfile(dawgfilename);
-
- if ( !dawgfile.exists() ) {
- QString fn = dictDir() + "/words";
- if ( QFile::exists(words_lang) )
- fn = words_lang;
- QFile in(fn);
- if ( in.open(IO_ReadOnly) ) {
- fixed_dawg->createFromWords(&in);
- dawgfile.open(IO_WriteOnly);
- fixed_dawg->write(&dawgfile);
- dawgfile.close();
+ if ( !docDirCreated )
+ createDocDir();
+
+ fixed_dawg = new QDawg;
+ QString dawgfilename = dictDir() + "/dawg";
+ QString words_lang;
+ QStringList langs = Global::languageList();
+ for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
+ QString lang = *it;
+ words_lang = dictDir() + "/words." + lang;
+ QString dawgfilename_lang = dawgfilename + "." + lang;
+ if ( QFile::exists(dawgfilename_lang) ||
+ QFile::exists(words_lang) ) {
+ dawgfilename = dawgfilename_lang;
+ break;
+ }
}
- } else {
- fixed_dawg->readFile(dawgfilename);
- }
+ QFile dawgfile(dawgfilename);
+
+ if ( !dawgfile.exists() ) {
+ QString fn = dictDir() + "/words";
+ if ( QFile::exists(words_lang) )
+ fn = words_lang;
+ QFile in(fn);
+ if ( in.open(IO_ReadOnly) ) {
+ fixed_dawg->createFromWords(&in);
+ if (dawgfile.open(IO_WriteOnly))
+ fixed_dawg->write(&dawgfile);
+ dawgfile.close();
+ }
+ } else
+ fixed_dawg->readFile(dawgfilename);
}
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 8c585f4..8f654d5 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -193,6 +193,7 @@ void Output::saveOutput() {
QFile f(filename);
- f.open( IO_WriteOnly);
- if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
+ if ( !f.open( IO_WriteOnly ) )
+ owarn << "Could no open file" << oendl;
+ else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
DocLnk lnk;
lnk.setName(name); //sets file name
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
index 4c15fd0..d89edbd 100644
--- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp
+++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
@@ -73,5 +73,8 @@ KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
clear();
QFile iofile(file);
- iofile.open(IO_ReadOnly);
+ if (!iofile.open(IO_ReadOnly)) {
+ owarn << "failed to open file " << iofile.name() << oendl;
+ return;
+ }
QTextStream stream(&iofile);
stream.setCodec(codec);
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 3654639..75a96a6 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -243,7 +243,10 @@ bool UserDialog::addUser(int uid, int gid)
if((adduserDialog->groupComboBox->currentItem()!=0))
{
- accounts->findGroup(adduserDialog->groupComboBox->currentText());
- adduserDialog->groupID=accounts->gr_gid;
- owarn << QString::number(accounts->gr_gid) << oendl;
+ // making the call findGroup() puts the group info in the accounts gr_gid
+ if (accounts->findGroup(adduserDialog->groupComboBox->currentText()))
+ {
+ adduserDialog->groupID=accounts->gr_gid;
+ owarn << QString::number(accounts->gr_gid) << oendl;
+ }
}
if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),