summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/filereceive.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/filereceive.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filereceive.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/filereceive.cpp b/noncore/apps/opie-console/filereceive.cpp
index 452be60..41e6888 100644
--- a/noncore/apps/opie-console/filereceive.cpp
+++ b/noncore/apps/opie-console/filereceive.cpp
@@ -1,29 +1,30 @@
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
+#include <opie2/odebug.h>
#include <qsocketnotifier.h>
#include "io_layer.h"
#include "procctl.h"
#include "filereceive.h"
FileReceive::FileReceive( Type t, IOLayer* lay, const QString& dir )
: ReceiveLayer(lay, dir ), m_type( t )
{
m_fd = -1;
m_not = 0l;
m_proc = 0l;
}
FileReceive::~FileReceive() {
}
void FileReceive::receive() {
receive( currentDir() );
}
void FileReceive::receive( const QString& dir ) {
m_prog = -1;
m_fd = layer()->rawIO();
m_curDir = dir;
if (pipe( m_comm ) < 0 )
@@ -127,36 +128,37 @@ void FileReceive::setupChild() {
if (m_comm[0] )
close( m_comm[0] );
/*
* now set the communication
* m_fd STDIN_FILENO
* STDOUT_FILENO
* STDERR_FILENO
*/
dup2( m_fd, STDIN_FILENO );
dup2( m_fd, STDOUT_FILENO );
dup2( m_comm[1], STDERR_FILENO );
}
void FileReceive::slotRead() {
QByteArray ar(4096);
int len = read(m_comm[0], ar.data(), 4096 );
for (int i = 0; i < len; i++ ) {
// printf("%c", ar[i] );
}
ar.resize( len );
QString str( ar );
}
void FileReceive::slotExec() {
char buf[2];
- ::read(m_term[0], buf, 1 );
+ if (::read(m_term[0], buf, 1 ) == -1)
+ owarn << "read of m_term[0] failed" << oendl;
delete m_proc;
delete m_not;
m_not = m_proc = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
close( m_comm[1] );
layer()->closeRawIO(m_fd);
emit received(QString::null);
}