summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/filereceive.cpp
Unidiff
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,21 +1,22 @@
1#include <unistd.h> 1#include <unistd.h>
2#include <fcntl.h> 2#include <fcntl.h>
3#include <signal.h> 3#include <signal.h>
4#include <errno.h> 4#include <errno.h>
5 5
6#include <opie2/odebug.h>
6#include <qsocketnotifier.h> 7#include <qsocketnotifier.h>
7 8
8#include "io_layer.h" 9#include "io_layer.h"
9#include "procctl.h" 10#include "procctl.h"
10#include "filereceive.h" 11#include "filereceive.h"
11 12
12FileReceive::FileReceive( Type t, IOLayer* lay, const QString& dir ) 13FileReceive::FileReceive( Type t, IOLayer* lay, const QString& dir )
13 : ReceiveLayer(lay, dir ), m_type( t ) 14 : ReceiveLayer(lay, dir ), m_type( t )
14{ 15{
15 m_fd = -1; 16 m_fd = -1;
16 m_not = 0l; 17 m_not = 0l;
17 m_proc = 0l; 18 m_proc = 0l;
18} 19}
19FileReceive::~FileReceive() { 20FileReceive::~FileReceive() {
20} 21}
21void FileReceive::receive() { 22void FileReceive::receive() {
@@ -135,28 +136,29 @@ void FileReceive::setupChild() {
135 */ 136 */
136 dup2( m_fd, STDIN_FILENO ); 137 dup2( m_fd, STDIN_FILENO );
137 dup2( m_fd, STDOUT_FILENO ); 138 dup2( m_fd, STDOUT_FILENO );
138 dup2( m_comm[1], STDERR_FILENO ); 139 dup2( m_comm[1], STDERR_FILENO );
139} 140}
140void FileReceive::slotRead() { 141void FileReceive::slotRead() {
141 QByteArray ar(4096); 142 QByteArray ar(4096);
142 int len = read(m_comm[0], ar.data(), 4096 ); 143 int len = read(m_comm[0], ar.data(), 4096 );
143 for (int i = 0; i < len; i++ ) { 144 for (int i = 0; i < len; i++ ) {
144 // printf("%c", ar[i] ); 145 // printf("%c", ar[i] );
145 } 146 }
146 ar.resize( len ); 147 ar.resize( len );
147 QString str( ar ); 148 QString str( ar );
148} 149}
149void FileReceive::slotExec() { 150void FileReceive::slotExec() {
150 char buf[2]; 151 char buf[2];
151 ::read(m_term[0], buf, 1 ); 152 if (::read(m_term[0], buf, 1 ) == -1)
153 owarn << "read of m_term[0] failed" << oendl;
152 delete m_proc; 154 delete m_proc;
153 delete m_not; 155 delete m_not;
154 m_not = m_proc = 0l; 156 m_not = m_proc = 0l;
155 close( m_term[0] ); 157 close( m_term[0] );
156 close( m_term[1] ); 158 close( m_term[1] );
157 close( m_comm[0] ); 159 close( m_comm[0] );
158 close( m_comm[1] ); 160 close( m_comm[1] );
159 layer()->closeRawIO(m_fd); 161 layer()->closeRawIO(m_fd);
160 emit received(QString::null); 162 emit received(QString::null);
161 163
162} 164}