summaryrefslogtreecommitdiff
path: root/core/launcher
Side-by-side diff
Diffstat (limited to 'core/launcher') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/qprocess_unix.cpp6
-rw-r--r--core/launcher/server.cpp19
2 files changed, 19 insertions, 6 deletions
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
@@ -268,97 +268,101 @@ QProcessManager::~QProcessManager()
odebug << "QProcessManager: restore old sigchild handler" << oendl;
#endif
if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 )
owarn << "Error restoring SIGCHLD handler" << oendl;
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager: restore old sigpipe handler" << oendl;
#endif
if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 )
owarn << "Error restoring SIGPIPE handler" << oendl;
}
void QProcessManager::append( QProc *p )
{
procList->append( p );
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl;
#endif
}
void QProcessManager::remove( QProc *p )
{
procList->remove( p );
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl;
#endif
cleanup();
}
void QProcessManager::cleanup()
{
if ( procList->count() == 0 ) {
QTimer::singleShot( 0, this, SLOT(removeMe()) );
}
}
void QProcessManager::removeMe()
{
if ( procList->count() == 0 ) {
qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager );
QProcessPrivate::procManager = 0;
delete this;
}
}
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;
#endif
QProc *proc;
QProcess *process;
bool removeProc;
proc = procList->first();
while ( proc != 0 ) {
removeProc = FALSE;
process = proc->process;
QProcess *process_exit_notify=0;
if ( process != 0 ) {
if ( !process->isRunning() ) {
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl;
#endif
// read pending data
int nbytes = 0;
if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl;
#endif
process->socketRead( proc->socketStdout );
}
nbytes = 0;
if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl;
#endif
process->socketRead( proc->socketStderr );
}
if ( process->notifyOnExit )
process_exit_notify = process;
removeProc = TRUE;
}
} else {
int status;
if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) {
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess not available)" << oendl;
#endif
removeProc = TRUE;
}
}
if ( removeProc ) {
QProc *oldproc = proc;
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
@@ -322,106 +322,114 @@ bool Server::setKeyboardLayout( const QString &kb )
QWSServer::setOverrideKeys( om );
return TRUE;
}
#endif
void Server::systemMsg(const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "securityChanged()" ) {
if ( transferServer )
transferServer->authorizeConnections();
if ( qcopBridge )
qcopBridge->authorizeConnections();
#warning FIXME support TempScreenSaverMode
#if 0
} else if ( msg == "setTempScreenSaverMode(int,int)" ) {
int mode, pid;
stream >> mode >> pid;
tsmMonitor->setTempMode(mode, pid);
#endif
} else if ( msg == "linkChanged(QString)" ) {
QString link;
stream >> link;
odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl;
docList->linkChanged(link);
} else if (msg =="reforceDocuments()") {
docList->reforceDocuments();
} else if ( msg == "serviceChanged(QString)" ) {
MimeType::updateApplications();
} else if ( msg == "mkdir(QString)" ) {
QString dir;
stream >> dir;
if ( !dir.isEmpty() )
mkdir( dir );
} else if ( msg == "rdiffGenSig(QString,QString)" ) {
QString baseFile, sigFile;
stream >> baseFile >> sigFile;
QRsync::generateSignature( baseFile, sigFile );
} else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
QString baseFile, sigFile, deltaFile;
stream >> baseFile >> sigFile >> deltaFile;
QRsync::generateDiff( baseFile, sigFile, deltaFile );
} else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
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" );
QDir dir;
dir.setPath( "/tmp/rdiff" );
QStringList entries = dir.entryList();
for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
dir.remove( *it );
} else if ( msg == "sendHandshakeInfo()" ) {
QString home = getenv( "HOME" );
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
e << home;
int locked = (int) ServerApplication::screenLocked();
e << locked;
#endif
} else if ( msg == "sendVersionInfo()" ) {
/*
* @&$*! Qtopiadesktop relies on the major number
* to start with 1. (or 2 as the case of version 2.1 will be)
* we need to fake 1.7 to be able
* to sync with Qtopiadesktop 1.7.
* We'll send it Opie's version in the platform string for now,
* until such time when QD gets rewritten correctly.
*/
QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" );
QString opiename = "Opie "+QString(QPE_VERSION);
QString QDVersion="1.7";
e << QDVersion << opiename;
} else if ( msg == "sendCardInfo()" ) {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
#endif
storage->update();
const QList<FileSystem> &fs = storage->fileSystems();
QListIterator<FileSystem> it ( fs );
QString s;
QString homeDir = getenv("HOME");
QString homeFs, homeFsPath;
for ( ; it.current(); ++it ) {
int k4 = (*it)->blockSize()/256;
if ( (*it)->isRemovable() ) {
s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr
+ QString::number( (*it)->availBlocks() * k4/4 )
+ "K " + (*it)->options() + ";";
} else if ( homeDir.contains( (*it)->path() ) &&
(*it)->path().length() > homeFsPath.length() ) {
@@ -953,54 +961,55 @@ void Server::postDirectAccess()
// Get rid of the dialog
if ( syncDialog ) {
delete syncDialog;
syncDialog = 0;
}
#warning FIXME support TempScreenSaverMode
#if 0
QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
#endif
} else {
qrr = new QueuedRequestRunner( file, syncDialog );
connect( qrr, SIGNAL(finished()),
this, SLOT(finishedQueuedRequests()) );
QTimer::singleShot( 100, qrr, SLOT(process()) );
// qrr will remove the sync dialog later
}
#endif
}
void Server::finishedQueuedRequests()
{
if ( qrr->readyToDelete ) {
delete qrr;
qrr = 0;
// Get rid of the dialog
if ( syncDialog ) {
delete syncDialog;
syncDialog = 0;
}
#warning FIXME support TempScreenSaverMode
#if 0
QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
#endif
} else {
qrr->readyToDelete = TRUE;
QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) );
}
}
void Server::startSoundServer() {
if ( !process ) {
process = new Opie::Core::OProcess( this );
connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
SLOT(soundServerExited()));
}
process->clearArguments();
*process << QPEApplication::qpeDir() + "bin/qss";
- process->start();
+ if (!process->start())
+ owarn << "Sound server process did not start" << oendl;
}
void Server::soundServerExited() {
QTimer::singleShot(5000, this, SLOT(startSoundServer()));
}